views:

132

answers:

2

I am trying to figure out the collision physics for a top-down racing game in Flash / AS3. I am currently using the hitTestPoint method for detecting collisions, but I don't know how to apply a decent physics method to bounce a vehicle off of a wall that it hits. Does anyone have any ideas or perhaps be able to point me in the right direction?

+1  A: 

This should be what you need: Emanuele Feronato - CREATE A FLASH RACING GAME TUTORIAL (AS3 VERSION). Might what to check out the AS2 version for a bit more detail.

TandemAdam
When I use his implementation, any time I adjust the speed the car will drive through the barriers and behave erratically. It's a great idea, but doesn't work well.
quade
+1  A: 

If you are just trying to figure out what to do, to get started with game programming, then TandemAdam's link seems like a great place to start.

If you need something a bit more involved, then I suggest you plug into someone else's physics engine: http://box2dflash.sourceforge.net/

If you want something in-between, and are willing to dive into learning a lot about basic game physics, then see this tutorial: http://www.metanetsoftware.com/technique.html (note, the link seems to be down for me, right now, but that might just be my work's proxy. Google cache is still picking it up)

Merlyn Morgan-Graham