Archived

This topic is now archived and is closed to further replies.

Bouncing ball 2!!!!!

This topic is 5047 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I just want to bounce my circle in the window screen.I have programmed the circle or ball but I am not sure how to move the ball and how is it going to bounce back when it hits any one of the window edges!!!!!! [edited by - smileon on February 22, 2004 2:18:13 AM]

Share this post


Link to post
Share on other sites
if( x > xmax ) { x_speed = - SPEED; }
if( x < xmin ) { x_speed = SPEED; }
if( y > ymax ) { y_speed = -SPEED; }
if( y < yin ) { y_speed = SPEED; }

x += x_speed;
y += y_speed;

DrawBallAt( x, y );

Victor Nicollet, INT13 game programmer



[edited by - ToohrVyk on February 22, 2004 5:30:08 AM]

Share this post


Link to post
Share on other sites