Bouncing off walls

here the thing. im trying yet again to make a pong lookalike, the whole ball bouncing off the walls thing, and it works fine…a little. but everytime the ball hits the paddle, it goes on to hit the top wall and the top wall bounces it back down, so when it hits the paddle again it goes back and hits the top wall and then the paddle and then the top wall etc. i know the problem, i just dont know how to solve it. i need to find a way for the ball to randomly bounce from the walls according to the direction in which it came from. i was thinking maybe i should make three smaller mcs in the paddle mc and make a different bounce action on each. ive posted the fla just in case

ps. i havent put the movement script on the paddle. just leave it where it is already positioned, test the movie and wait for it to hit the paddle. then youll see what im talking about.

Check out some of the code contained here:

http://www.macromedia.com/desdev/mx/flash/articles/mc_subclasses02.html

Hope it helps.

  • wobbly

looks like maybe you need some gravity or some force. Bit-101 got me going with forces…

http://www.bit-101.com/tutorials/gravity.html

looks like thisis going to be a lot more complicated than i had figured

:slight_smile: Sometimes it is much harder, sometimes it is unbelievably easy.