#### Archived

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

# Bouncing ball 2!!!!!

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

## 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 on other sites
You will need to translate the ball, and to make it bounce, you will need to check for the correct x,y coords, if it''s at a certian point where it would be considered the wall, you reverse the volocity. What a bad explination

Dustin Davis
Owner / CEO
Programmers Unlimited
www.Programmers-Unlimited.com

##### 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]

1. 1
Rutin
29
2. 2
3. 3
4. 4
5. 5

• 13
• 13
• 11
• 10
• 13
• ### Forum Statistics

• Total Topics
632960
• Total Posts
3009472
• ### Who's Online (See full list)

There are no registered users currently online

×