-
Bullets bounce off walls
I'm trying to make a flash port of the WiiPlay Tanks game for an independent studies project. I've got the player shooting bullets, and the turret follows the mouse correctly.
The problem I have now is that I want the bullets to bounce off the walls, which can be either horizontal or vertical. I'm not a big math guy, so can anyone help me out? Or point me in the right direction?
-
Senior Member
just flip the speed components, e.g. bouncing from vertical wall would be velocity.x *= -1 and bouncing from horizontal wall would be velocity.y *= -1.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|