Some help on acceleration...
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Some help on acceleration...

  1. #1
    Hey I need some help with a car game I was making..
    well the game really sucks without acceleration and deceleration...
    Can anyone help me with the math part on that?

    Simulating acceleration and deceleration
    Anyhelp would be great
    email is Ryan__west@hotmail.com

  2. #2
    Senior Member
    Join Date
    Jan 2002
    Posts
    368
    Code:
    acc=.5;
    vel=0;
    car._x=0;
    onEnterFrame=function(){
       vel+=acc;
       car._x+=vel;
    }
    simply add your acceleration to your velocity each frame, then add velocity to position. deceleration is just negative value for acceleration.

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

Poll by Flashkit.com