Jump to content
  • Advertisement
Sign in to follow this  

Paddle ball breakout

This topic is 3746 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 was thinking that after i finish the cpp module 2 at gameinstitute.com i might try to make a game that uses the brick breaking of breakout with instead of just a ball bouncing back and forth using some sort of elastic band effect between the ball and paddle. Any suggestions on how i might do this? By the way it will be done with gdi and programmer art.

Share this post

Link to post
Share on other sites
Sure, just model the elastic band as a spring obeying Hooke's Law. Ignore forces produced by the band being below its rest length.

Or, in other words:

rest_length = xxx
stiffness = yyy

each frame:
spring_displacement = ball_position - paddle_position
spring_length = length(spring_displacement)
if spring_length > rest_length:
ball_acceleration = normalize(spring_displacement) * (rest_length - spring_length) * stiffness
ball_velocity += ball_acceleration * dT
ball_position += ball_velocity * DT

Also, moved to For Beginners.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • 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!