PDA

Click to See Complete Forum and Search --> : Motion



gimpy16
04-17-2002, 07:20 PM
Well, im making a game. Ive gotten the "character" to move left and right using the keyboard... but i want when you let go of the button your "character" slows to a stop... any help in this matter would be appreciated

bit-101
04-18-2002, 08:33 AM
instead of the arrows controlling the character directly, use them to set a speed value. like speed=10 or speed=-10 if the right/left keys are pressed.

then throw in some friction by reducing the speed by a small percentage each frame

speed*=.9;

and add the speed to the _x of you character

myguy._x+=speed;

gimpy16
04-19-2002, 01:22 AM
I feel a little bit like an idiot posting this :) heh. I figured it out shortly after... My problem was that i made a invisible button that checked for keypress :p but it works good... wanna see it... :p lol its the stupidest thing but here is the url http://members.shaw.ca/mikemclellan/flash/jumpbox.html and for me this is advaced :P heh just stared with flash not to long ago... been lazy latly