Page 1 of 1

heli won't fall down?

PostPosted: Tue Mar 03, 2009 2:59 am
by refresh
for key down i put
Code: Select all
x = x +5;
 y = y -3;

that works fine. it rises and moves forward.
then so it falls and moves forward i put into key down
Code: Select all
x = x +5;
y = y +3;

then it dose it for 1 millisecond. how do i repeat it so if im not holding a key it moves forward and falls? :wink:

when i get this right ill give you guy's a demo.

Re: heli won't fall down?

PostPosted: Tue Mar 03, 2009 3:36 am
by skydereign
If I get what you are saying, upon key down, you can set the move right in script by doing this
Code: Select all
xvelocity=5; // sets the velocity, to stop you would need an event that sets it to 0
y-=5; // your rising


In the draw actor event, you should use this for your gravity
Code: Select all
yvelocity+=(whatever value you want gravity); // usually 1 or less, I think

Re: heli won't fall down?

PostPosted: Tue Mar 03, 2009 4:00 am
by refresh
hey it worked thx again skydereign
my friend :D

Re: heli won't fall down?

PostPosted: Tue Mar 03, 2009 4:18 am
by refresh
key down event
Code: Select all
x = x +5;
y = y -4;


key up event
Code: Select all
xvelocity = xvelocity = +5;
yvelocity = yvelocity +4;


these are my current codes on actor at first it worked then around the third time it shot forward (to the right) with great speed. i was confused so i messed around checked my code but nothing was wrong now what did i do wrong?

Re: heli won't fall down?

PostPosted: Tue Mar 03, 2009 4:29 am
by refresh
here's my game you may mess with it and tell me problem. :D :D
comment on beta plz.

Re: heli won't fall down?

PostPosted: Tue Mar 03, 2009 5:16 am
by skydereign
I think this is what you wanted. Upon the keydown you set the xvelocity. Until you change the xvelocity, the actor will continuously move right. Then, since you want the helicopter to rise, do the y+=3. This will make you go up only when pressing up. Then a draw actor script, you put y+=2, to set gravity. For this game you would not use the yvelocity+=, as it is not the proper gravity system. This will make your helicopter fall at all times, rising only when you press up.

As for the game, it is a good start. I don't really know where you are going with it though. At this point you could take it many ways, calculating score by distance, by enemies (if you add them), or some other paths. You might tweak the values, I just set them to relatively fitting values.