I want to know what's the best way of detecting the collision with a diagonal obstacle on a html canvas. Checking the x and y coordinates of the player against the coordinates of the obstacle works fine for objects that are not placed diagonally. For the latter ones, I should check the x and y coordinates of all points along the y and x axis, which might affect the performance when you have a lot of obstacles. How can I avoid that?
1.4m articles
1.4m replys
5 comments
56.9k users