A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Motion

  1. #1
    Junior Member
    Join Date
    Apr 2002
    Posts
    13
    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

  2. #2
    Senior Member
    Join Date
    Jan 2002
    Posts
    368
    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;

  3. #3
    Junior Member
    Join Date
    Apr 2002
    Posts
    13
    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 but it works good... wanna see it... 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center