|
@ -1,7 +1,9 @@ |
|
|
package pacmanGame; |
|
|
package pacmanGame; |
|
|
import java.util.Random; |
|
|
import java.util.Random; |
|
|
public class GhostBehaviorRandom implements GhostBehavior { |
|
|
public class GhostBehaviorRandom implements GhostBehavior { |
|
|
|
|
|
|
|
|
|
|
|
public int player; |
|
|
|
|
|
public int ghost; |
|
|
|
|
|
public boolean isPlayerAlive = true; |
|
|
@Override |
|
|
@Override |
|
|
public Vector2 GetDirection(Ghost ghost) { |
|
|
public Vector2 GetDirection(Ghost ghost) { |
|
|
Random random = new Random(); |
|
|
Random random = new Random(); |
|
@ -20,5 +22,9 @@ public class GhostBehaviorRandom implements GhostBehavior { |
|
|
} |
|
|
} |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void checkCollision() { |
|
|
|
|
|
if (player == ghost) { |
|
|
|
|
|
isPlayerAlive = false; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |