Jump to content
  • Advertisement

Archived

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

smileon

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.

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
Advertisement
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 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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!