Advertisement

eep! breakout clone, may ball always get stuck!

Started by September 08, 2002 06:37 AM
10 comments, last by mickey 22 years, 5 months ago
Im guessing that if elapsed time is large, then your ball goes past the collision wall ( which would happen if you were just doing something like if xpos=xbound instead of if xpos>=xBound ).

Well.. actually it should be xPos+(elapsedTime*xVel)>=xBound then reverse velocity and calc new position.
stevenmarky, thanks! my problems has just vanished! i don''t calculate the new position becuase i don''t know how to get the exact coordinate where the ball hits the block so i just reverse it,

devepermen, i don''t see any difference between using the abs and just appending a negative sign before the velocity. and you said

quote:

if you hit the top, you don''t invert your y coordinate


but in your code you made this?
if(hit_top) y = -abs(y); ??

isn''t that inverting as well? i''m sorry but i don''t get it, hope you culd explain more, thanks
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,

This topic is closed to new replies.

Advertisement