+ 1
Why some objects stuck for sometime on one of the canvas boundaries although the collision detection condition works ?
13 Answers
+ 1
FF9900
Thank you, how to solve this problem ?
+ 1
FF9900
if((y+radius)>canvas.height||(y-radius)<0){dy*=-1;}
What's wrong with this condition ?
+ 1
FF9900
Take your time.
+ 1
FF9900
It works great, thank you very much.
0
FF9900
It flips the direction.
Is the problem related to compare float numbers ?
0
Round x and y gave slightly improvement to skip quicker from the stuck.
No, dx stands for "direction x", it's always 1 or -1.