diff --git a/src/main/java/pacmanGame/Vector2.java b/src/main/java/pacmanGame/Vector2.java index d2e95ef..e9da7c8 100644 --- a/src/main/java/pacmanGame/Vector2.java +++ b/src/main/java/pacmanGame/Vector2.java @@ -29,6 +29,14 @@ public class Vector2 { ); } + public boolean isWithin(Vector2 area) { + return this.x < area.x && + this.y < area.y && + this.x >= 0 && + this.y >= 0 + ; + } + public Vector2 Clone() { return new Vector2(this.x, this.y); }