View Single Post
Old 11-11-2008, 07:19 AM   #35

Activity Longevity
0/20 18/20
Today Posts
0/11 sssssss84
Location: Tuckahoe, NY

Originally Posted by Claxon View Post
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.
So I currently have a struct for the ball that has x position, y position, xspeed, yspeed, and image variables. I will be updating that and creating an update function that will feed the paint function the current parameters of that balls position. Do I have the general idea down? Sorry for the annoyances, this is my first game and I just want to make sure I am on the right path.
Mike M
Facebook Profile LinkedIn Profile
Duckman is offline