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.
eep! breakout clone, may ball always get stuck!
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
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
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
Popular Topics
Advertisement
Recommended Tutorials
Advertisement