View Single Post
Old 11-11-2008, 05:50 AM   #33
Senior Member

Activity Longevity
0/20 18/20
Today Posts
0/11 ssssss345
Location: London

QA lead? You want to sit at your pc, browsing your e-mails all day and telling your minions to "test it again"?

If your balls and paddles are drawing the rest is quite simple, declare 2 float variables to store the balls speed (one is the X axis speed, the other is the Y axis speed), then every update add the speed values onto your balls position. Then if the ball hits the walls on the top or bottom reverse the Y speed ( ySpeed = -ySpeed; ) and the ball will bounce. Same for the X speed value if it hits a paddle. You really don't have far to go.

Ps. What I've said there is a very basic way to get the ball bouncing. You may want to improve on it later, by increasing the ball speed slightly each time it bounces, or making it change direction depending on where it hits the paddle.

Last edited by Claxon : 11-11-2008 at 05:52 AM.
Claxon is offline