Paddle ball breakout

Started by
1 comment, last by Wizecoder 15 years, 8 months ago
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.
Check out my new blog: http://beefmachinegames.wordpress.com
Advertisement
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 = xxxstiffness = yyyeach 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.
Thanks I will study this and try to see how to use it.
Check out my new blog: http://beefmachinegames.wordpress.com

This topic is closed to new replies.

Advertisement