Skip navigation
Borrick
Currently Being Moderated

Help With Car Movement

Apr 27, 2008 9:23 AM

Hi, I am trying to make a car game, but my car movement is mucked up and I'm not sure why. It also needs brakes and acceleration. I am really a noob to actionscript and any help would be much appreciated.
Attach this code to a movieclip of some sort.
 
Replies
  • kglad
    62,200 posts
    Jul 21, 2002
    Currently Being Moderated
    Apr 27, 2008 12:22 PM   in reply to Borrick
    your _x and _y properties should be incremented by yspeed times Math.cos(_rotation*Math.PI/180) and Math.sin(_rotation*Math.PI/180), resp.
     
    |
    Mark as:
  • kglad
    62,200 posts
    Jul 21, 2002
    Currently Being Moderated
    Apr 29, 2008 12:10 PM   in reply to Borrick
    where you're incrementing your movieclip's _x and _y properties.
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 29, 2008 12:20 PM   in reply to Borrick
    I would suggest changing your approach slightly - in conjunction with what kglad has recommended here - and add a velocity component and another conditional statement to apply the friction reduction - I would also add a heading component as well, as for further control, but using the rotation value will work. more like this:
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 24, 2010 1:01 PM   in reply to Borrick

    U know i made a driving game, soo i can post my code from the car, if you want...

    i hane acceleration, deceleration stearing with rotation, and nouncing from boundaryes...

    just say if you want me to...

     
    |
    Mark as:
  • kglad
    62,200 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 24, 2010 1:14 PM   in reply to NikolaV97

    if he's stilll working on that after 2 years, he needs more help than your code.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 24, 2010 4:00 PM   in reply to kglad

    xaxaxax! yea, i guess soo... but he's probably given up by now... or maybe he made it, there are a lot of usefull tuturials on youtube, and a lot of sites with flash tutorials like flash kit, and those can come in handy...

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points