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

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

Quote:
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