We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a051ab5 commit c6ad74dCopy full SHA for c6ad74d
1 file changed
geometry/collision_detection.py
@@ -0,0 +1,11 @@
1
+def is_colliding(rect1, rect2):
2
+ """
3
+ Checks if rect1 and rect2 collide.
4
+ rect1, rect2: tuples (x, y, width, height)
5
+ Returns: True if colliding, else False
6
7
+ x1, y1, w1, h1 = rect1
8
+ x2, y2, w2, h2 = rect2
9
+ horizontal = (x1 + w1 >= x2) and (x2 + w2 >= x1)
10
+ vertical = (y1 + h1 >= y2) and (y2 + h2 >= y1)
11
+ return horizontal and vertical
0 commit comments