Created
September 12, 2018 18:33
-
-
Save themisir/9c119ceae46e4d122068797bb5d3d849 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean collides(Rectangle r1, Rectangle r2) { | |
return | |
(r2.left() >= r1.left() && r2.left() <= r1.right()) || | |
(r2.right() >= r1.left() && r2.right() <= r1.right()) || | |
(r2.top() >= r1.top() && r2.top() <= r1.bottom()) || | |
(r2.bottom() >= r1.top() && r2.bottom() <= r1.bottom()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment