398 Forum Posts by "DrRobot"
Hey, i'm trying to figure out how to draw a parabola, or some vector that traces the path of an object launched at a certain angle and a certain speed.
I'm using box2d and wanted to draw a line that would trace the path through the mouse from the launching point. I know the velocity of the object, starting point, and that it has to pass through the coordinates of the mouse.
How would this be done? Would I use curveTo? And how would I know where to curve to? I also don't know where the object will stop.
I want to do basically what has been done in this:
-
Soccer Balls by turboNukeClick to view.
- Type
- Game
- Rated
- Everyone
http://www.newgrounds.com/portal/view/53 8652
Thanks
No, I want a cookie that is called 24. I want the name of the cookie to be the value of the variable.
I guess you've already told me what the problem was though. Cookies can't have names that are just numbers, right? I think I've found a way around this problem though. I'll just make the variable a string, and add a letter in there at the beginning or something.
Hey,
I noticed that when I tried to make a cookie that had a php variable as the name, like this:
$phpvr = 24;
setcookie($phpvr, $phpvr, time()+60);
it wouldn't create the cookie. I printf'd all the cookies and there was no cookie called 24...
I tried this:
$phpvr = 24;
setcookie((string)$phpvr, $phpvr, time()+60);
but that didn't work. So, how do I go about doing this?
Thanks,
Thomas Francis
At 2/1/10 07:49 PM, knugen wrote: Translator software isn't good enough to replace a human being yet, I definitely wouldn't put something Google translated into a game if I have no chance to actually verify it.
OP: If you need Swedish and don't mind if it takes a little while give me a shout
Just PMed you
Yeah, translation software is not good enough. I need human translations, Google isn't gonna cut it.
Hi,
I'm looking for people to help translate my new (non-stacking) physics game into a variety of languages. Currently I need Arabic, Chinese (Simplified and Traditional), Japanese, Finnish, and French.
It's around 40 lines total, and about 15 of them are just single words.
PM me to see the lines, ask questions, discuss payment, or whatever. Alternatively, you can reply here with a way for me to contact you.
Thanks,
Thomas Francis
Hey, how do I get medals in a game I'm making? I didn't really see any options in the flash API page.
Thanks.
It's been two days... Not even an idea?
Hey, i'm working on a website and I'm using TinyMCE and i'm trying to validate the form when the textarea is empty or has whitespace. But, the editor automatically adds html tags when you do things, such as press enter. When you press enter in the textbox, and then trace the contents, the textbox returns as:
<p> </p>
<p> </p>
As you press enter more and more, that same bit of code keeps being added. So how do i check if the textbox is filled with that code?
I prefer Javascript, but if PHP is the only way, then i'll use PHP.
Thanks.
I was thinking that I might make a last login field and store the time when they leave the website, or last log in or seomthing, and any topic that has a time stamp newer than than the one stored in the one on the user, then just display those with the "new" icons. But there is the problem of the setting the "new" ones that were looked at back to regular topics, and also, updating the time since they were on the website last.
Hey, currently I'm building a forum, and it's going pretty good so far, however, however, how do i implement the updated since you were gone things? Like here on newgrounds, when somebody posts and you sign on, the picture by the post is yellow. How do i do that in my forum? At least what sort of thing am I looking to do to achieve this?
BTW, everything is custom, so i can modify jsut about anything.
Oh, right, daily fifths don't count. But still, i wasn't awarded a daily fifth...
I won a daily fifth at the beginning of this month, but wasn't awarded the trophy...
P bots post:
http://www.newgrounds.com/bbs/topic/1077 992
Also, my game got runner up too?
I've emailed Tom and Wade about it, but neither have replied. And that was a few weeks ago.
At 7/25/09 10:46 AM, Haggard wrote: In order to make a front page post you need to get ONE of the following awards in either the flash portal or the audio portal:
--FLASH PORTAL--
Daily 3rd
Daily 2nd
Daily 1st
Weekly 1st
Weekly 2nd
Weekly 4rd
Weekly 4th
Weekly 5th
Review Crew Pick
Underdog
-AUDIO-
Weekly winner 1st, 2nd, 3rd, 4th, or 5th.
Thanks to FatKidWitAJetPak for the text ;)
No, I know that. I was wondering how do people get their individual posts in that Artists News box.
How do i put one of my news posts on the front page?
I remember reading something about once a month, but i haven't put anything on the front page for a while.
How exactly do I get good SEO on a custom or homemade blog? Wordpress has amazing seo, how do they do it?
I think my blog is a modified version of woogie noogies... this link i think:
http://www.newgrounds.com/bbs/topic/4251 83
Are there ways to increase SEO with that blog system? or should i switch to wordpress?
Why didn't I get a daily 5th trophy? My game SpaceFlyer is in 5th, but i didn't get a daily 5th trophy?
When i go into the flash portal preferences and i change the drop down menu to classic, the save settings button just disappears. Like, it literally disappears.
So, is that intentional? or am I the only one?
When I try to sign up for the revenue system, specifically when I click the "I agree" button, it takes me to a page that displays "HTTP 500 Internal Server Error".
Has anyone else experienced this? How do I fix this problem?
At 4/13/09 02:34 PM, GustTheASGuy wrote: Don't want to see what you did, the easiest way is to represent the lines with vectors a,b and a vector c between their starting points. Then
dot (c.normal, b) / dot (a.normal, b)
..will be the scalar of where the point of intersection is along a. So if that number's between 0 and 1, the lines intersect.
I've already got some code that determines if two lines intersect.
Here's the code (you need to make an object called main, and add the vcam called vcam to the stage, though you can just comment that code out.):
//var lines:Array = new Array({x:5, y:0}, {x:0,y:187},{x:159.9,y:187},{x:270.9,y:241},{x:449.9,y:226},{x:522,y:198},{x:600,y:198},{x:700,y:50},{x:650,y:0},{x:5,y:0});
var lines:Array = new Array({x:4,y:284},{x:132,y:284},{x:204,y:326},{x:278,y:328},{x:341,y:312},{x:405,y:296},{x:445,y:296},{x:507,y:281},{x:536,y:163},{x:456,y:45},{x:272,y:15},{x:145,y:26},{x:118,y:18},{x:80,y:18},{x:58,y:7},{x:4,y:184},{x:4,y:284});
var col:Point = new Point(0,0);
var op:Point = new Point(main.x,main.y);
var line:Shape = new Shape();
addChild(line);
var grav:Number = 1.1;
var yspeed:Number = 0;
var canFall = true;
var currLine:int = 0;
var speed = 5;
var js = -15;
var coll = false;
var q:int = 0;
var i:int;
var keyArray:Array = new Array();
var t:int = 0;
for (i=0; i<222; i++) {
keyArray.push([i,false]);
}
stage.addEventListener(Event.ENTER_FRAME, loop);
stage.addEventListener(KeyboardEvent.KEY_UP, checkKeysUp);
stage.addEventListener(KeyboardEvent.KEY_DOWN, checkKeysDown);
line.graphics.lineStyle(1,0);
line.graphics.moveTo(lines[0].x,lines[0].y);
for (q=1; q<lines.length; q++) {
line.graphics.lineTo(lines[q].x, lines[q].y);
}
line.graphics.lineTo(lines[0].x, lines[0].y);
function loop(e:Event):void {
txt.text = op.y.toString();
vcam.x = main.x;
vcam.y = main.y;
if (keyisdown(39)) {
op.x = main.x;
main.x += speed;
}
if (keyisdown(37)) {
op.x=main.x;
main.x-=speed;
}
if (keyisdown(38)) {
//uncomment the yspeed conditional to limit the jump
//if (yspeed==0) {
coll=false;
yspeed=js;
//}
}
/*if (op.y!=main.y+yspeed+grav) {
op.y=main.y;
trace("smae");
//t = 0;
}*/
//op.y=main.y;
yspeed+=grav;
main.y+=yspeed;
//op.y = main.y + yspeed + grav;
for (q=0; q<lines.length-1; q++) {
if (SegCollide(op,new Point(main.x,main.y),lines[q],lines[q+1])) {
coll=true;
currLine=q;
break;
}
}
if (coll) {
LineCollide();
var xs=col.x-main.x;
var ys=col.y-main.y;
trace(xs+", "+ys);
/*
//this code is usable enough. you can actually change xs and ys with
//these, vx, and vy, and it'll work almost the exact same...
var ab=Math.atan2(lines[currLine].y-lines[currLine+1].y,lines[currLine].x-lines[currLine+1].x)*180/Math.PI-180;
var ac=Math.atan2(main.y-lines[currLine].y,main.x-lines[currLine].x)*180/Math.PI;
var diff=ac-ab;
trace("ab: "+ab);
var vx = Math.sin(ab*(Math.PI/180))*yspeed*-1;
var vy = Math.cos(ab*(Math.PI/180))*yspeed*-1;
trace(vx+", "+vy);*/
main.x=col.x+xs/4;
main.y=col.y+ys/4;
coll=false;
yspeed=0;
}
}
function LineCollide():void {
var s1y=main.y-op.y;
var s1x=main.x-op.x;
var s2y=lines[currLine+1].y-lines[currLine].y;
var s2x=lines[currLine+1].x-lines[currLine].x;
var sa1yb = s1x*-(main.y);
var sa1xb = s1y*-(main.x);
var sa2yb = s2x*-(lines[currLine].y);
var sa2xb = s2y*-(lines[currLine].x);
if (s1y!=s2y&&s1x!=s2x) {
var se1x=s1y/s1x;
var se1b = (sa1xb-sa1yb)/s1x;
var se2x=s2y/s2x;
var se2b = (sa2xb-sa2yb)/s2x;
col.x = (se2b-se1b)/(se1x-se2x);
col.y = (col.x*se1x)+se1b;
if (sa1yb==0) {
col.x = -(sa1xb)/s1y;
} else if (sa1xb == 0) {
col.y = -(sa1yb)/s1x;
}
if (sa2yb==0) {
col.x = -(sa2xb)/s2y;
} else if (sa2xb == 0) {
col.y = -(sa2yb)/s2x;
}
if (s1x==0&&s2x!=0) {
col.y = (se2x*col.x)+se2b;
} else if (s2x == 0 && s1x != 0) {
col.y = (se1x*col.x)+se1b;
}
trace("2"+col);
} else {
trace("no collision, parallel");
}
}
function SegCollide(a1:Point,a2:Point,b1:Object,b2:Object):Boolean {
//----------------------------------------------------------------------
var a1yb1y,a1xb1x,a2xa1x,a2ya1y;
var crossa,crossb;
//----------------------------------------------------------------------
a1yb1y=a1.y-b1.y;
a1xb1x=a1.x-b1.x;
a2xa1x=a2.x-a1.x;
a2ya1y=a2.y-a1.y;
//----------------------------------------------------------------------
crossa = a1yb1y * ( b2.x - b1.x ) - a1xb1x * ( b2.y - b1.y );
crossb = a2xa1x * ( b2.y - b1.y ) - a2ya1y * ( b2.x - b1.x );
//----------------------------------------------------------------------
if (crossb==0) {
return false;
} else if ( Math.abs( crossa ) > Math.abs( crossb ) || crossa * crossb < 0 ) {
return false;
} else {
crossa=a1yb1y*a2xa1x-a1xb1x*a2ya1y;
if (Math.abs(crossa)>Math.abs(crossb)||crossa*crossb<0) {
return false;
}
}
//----------------------------------------------------------------------
return true;
}
function checkKeysDown(event:KeyboardEvent):void {
keyArray[event.keyCode][1]=true;
}
function checkKeysUp(event:KeyboardEvent):void {
keyArray[event.keyCode][1]=false;
}
function keyisdown(X:Number):Boolean {
return keyArray[X][1];
}
[This is AS3, and the document is for Flash CS3]
Alright, so i've been working on some line segment vs line segment collision for awhile here now, and its only half working... the collision works vertically pretty well, but horizontally, not so well. It gets pretty glitchy moving my character into a vertical line (well, vertically orientated), not so much with moving the character into a line that's horizontally orientated.
I have a variable, op, meaning old point. old point is the last position that 'main' was in last. BUT, i can only change the X value without screwing this up, and I think that because i can't go ahead and change the Y value, it's the reason that i can't do certain collision so well. I can change the Y value of op, but when i do, 'main' gets 'stuck' and if you press the arrows keys like crazy, 'main' will just jump out...
oh, the usage behind op is that by updating the old pos, i can compare it with the new pos, and then do some adjustment to get 'main' out of a line.
here's the file, check it out:
http://www.theorangeday.com/Content/Line IntersectionWithSegs.fla
i found a wacom graphire4 6x8 (cte-640) on ebay for $40, and i bought it. so i have an awesome 6x8 tablet that works nicely.
This is Actionscript 3.
Alright, so i've been working on a game for a little while now, and this problem has basically just shown up. My game is 9 frames long, and the frames are as follows:
1 Preloader
2 dummy
3 exported stuff loading frame
4 cutscene frame
5 menu
6 character/level select
7 game frame
8 level result/cutscene frame
9 character editor
I start up, and i click through the cutscene and get to the menu and go to the next frame and i can either edit a character or play the game and get to the result frame. Now either way, i get to frame 8 or 9. I look at the frame doing some stuff, and when i go back to frame 6, level select, my frame rate is off the chart! its cruising! now, from there, if i go into the game, and i click a few times, it sorts the problem out, and the frame rate returns to normal. I have no idea why it does that though. Also, when i return to frame six i can hear the audio from my cutscene frame too... Best part is that i get no errors.
Has anyone had this problem? Do you think it's from duplicate variable definition?
yes, i think it does. are you checking circle objects with the name specified?
have you tried debugging to see then exact line that's causing the problem?
debug: ctrl shift enter
get on aim for easier help
you'd want to do soemthing along the lines of doing some trignometry, like, sin and cosine
speed = 35;
x += sin(rotationinradians)*speed;
y += cos(rotationinradians)*-1*speed;
you might want to change the DisplayObject to the class name of the the class of the objects you are using. you see, classes come preset with functions, and the stock classes (MovieClip, Shape, w/e) don't have the function "RemoveMe()" in them, so by changing the data type to the class that has that function, it should solve the problem.

