A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [F8] Realisic Car Game

  1. #1
    Junior Member
    Join Date
    Oct 2008

    Question [F8] Realisic Car Game

    Could someone please help me out with a uncommon code?
    Atleast I think it's uncommon...
    Anyways to the main point, I was wanting a code as I was making a sprite set for my game. I have praticily everything except the follow codes.
    • Realistic Car movement
    • Crash on to collisions

    For the car movement, What I think is realistic is. When you press up/accelerate the car will have a real aceleration which starts slow and moves faster gradualy but a certain speed that can be modified Also when you stop pressing up/accelerate, The car will soon slow down eventualy.

    For the crash effect. Is it possible to get a code that when a movie clip hitTest with the wall/colliso, the car will bounce off the wall I've tried to get the code somewhere but I didn't work realisticly.

    Thanks so much in advance!!

  2. #2
    Señor Member Mavrisa's Avatar
    Join Date
    Oct 2005
    I'm guessing you're somehow using velocity variables?
    If so, set them both opposite of what they were (ex: vx = -vx)
    and the car will rebound backwards at exactly the same speed. Sometimes this gives a problem where the car stays in the wall after the collision and vibrates around... so first take back your last movement by subtracting
    car._x -= vx
    car._y -= vy
    and then change the velocities to negative.

    You could also thinking about adding some spin, or changing the directions by a little bit (use math.random() to make the car not travel backwards at exactly the same angle as it came in at) to make it seem more realistic.
    Good luck
    Haikus are easy
    But sometimes they don't make sense

  3. #3
    Junior Member
    Join Date
    Oct 2008

    RE: [F8] Realisic Car Game

    No clue man - sorry.

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