A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Bullets bounce off walls

  1. #1
    Junior Member
    Join Date
    May 2009
    Posts
    4

    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?

  2. #2
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    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.
    who is this? a word of friendly advice: FFS stop using AS2

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