Paddle ball breakout
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.
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:
Also, moved to For Beginners.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement