+ 1

Why some objects stuck for sometime on one of the canvas boundaries although the collision detection condition works ?

19th Feb 2022, 7:16 PM
Mohammed
13 Respuestas
+ 1
FF9900 Thank you, how to solve this problem ?
19th Feb 2022, 7:22 PM
Mohammed
+ 1
FF9900 if((y+radius)>canvas.height||(y-radius)<0){dy*=-1;} What's wrong with this condition ?
19th Feb 2022, 7:36 PM
Mohammed
+ 1
FF9900 Take your time.
19th Feb 2022, 7:52 PM
Mohammed
+ 1
FF9900 It works great, thank you very much.
20th Feb 2022, 11:06 AM
Mohammed
0
FF9900 It flips the direction. Is the problem related to compare float numbers ?
19th Feb 2022, 7:40 PM
Mohammed
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.
19th Feb 2022, 7:47 PM
Mohammed