Match the test to the rule
For axis-aligned rectangles, compare each object's left, right, top, and bottom extents; overlap occurs when the intervals intersect on both axes. For circles, compare center distance with the sum of radii. A grid game can avoid geometry entirely by checking whether two actors claim the same cell.
Make a tiny diagnostic scene with two colored shapes and display their chosen hit regions. Move each pair through edge contact, partial overlap, and a near miss. Decide whether touching edges counts as collision and encode that convention once so movement and scoring do not disagree.
Avoid missing fast crossings
A fast object can be on one side of a thin wall on one update and on the other side on the next. Smaller fixed simulation steps can help, but are not the only answer: test a swept segment or expanded target when the movement range is large relative to the obstacle thickness.
With many objects, first reject pairs that cannot be near each other using a coarse grid or spatial buckets, then run detailed tests on the candidates. Measure before adding that structure; for a few dozen entities, straightforward pair checks may be easier to maintain and perfectly adequate.
Questions about game collision detection
Do hitboxes need to match sprite outlines?
Usually not. A slightly forgiving rectangle or circle can make controls feel fairer. Show hitboxes during development and tune them against the intended rule and player expectation.
Can Canvas tell me whether two sprites collide?
Canvas provides path tests such as isPointInPath() for checking a point against a drawn path, but it does not define general game-object collision rules. Keep simulation geometry explicit and independent of drawing.