diff --git a/src/main/java/pacmanGame/GhostBehaviorRandom.java b/src/main/java/pacmanGame/GhostBehaviorRandom.java index d461501..a60db09 100644 --- a/src/main/java/pacmanGame/GhostBehaviorRandom.java +++ b/src/main/java/pacmanGame/GhostBehaviorRandom.java @@ -1,7 +1,9 @@ package pacmanGame; import java.util.Random; public class GhostBehaviorRandom implements GhostBehavior { - +public int player; +public int ghost; +public boolean isPlayerAlive = true; @Override public Vector2 GetDirection(Ghost ghost) { Random random = new Random(); @@ -20,5 +22,9 @@ public class GhostBehaviorRandom implements GhostBehavior { } return null; } - + public void checkCollision() { + if (player == ghost) { + isPlayerAlive = false; + } + } }