PDA

Click to See Complete Forum and Search --> : hitting against a wall -"break out"


merhaba
Jan 19th, 2005, 12:25 PM
Hi,
I know how to code a simple "collision detection" in java script but I would like learn more about "an object hitting against another object(a wall) and move all around the room.randomly.just like in a "break out game"
could anyone give me a short sample of codes of that kind?
thanks

McCain
Jan 21st, 2005, 07:44 PM
Well, the ball in a break out game doesn't move around randomly. It calculates the new angle everytime it hitts the wall or a brick. You could do the same.
Just find a basic pong type of game in any language and translate it to JavaScript.
It's all about checking where the ball is and where the walls are.