fdai7753
11 months ago
4 changed files with 67 additions and 29 deletions
-
21src/main/java/pacmanGame/GameManager.java
-
22src/main/java/pacmanGame/Ghost.java
-
36src/main/java/pacmanGame/Map.java
-
11src/test/java/pacmanTests/MapTest.java
@ -1,12 +1,22 @@ |
|||||
package pacmanGame; |
package pacmanGame; |
||||
|
|
||||
public class Ghost { |
public class Ghost { |
||||
public Vector2 position; |
|
||||
public final GameManager gameManager; |
|
||||
|
public Vector2 position; |
||||
|
public final GameManager gameManager; |
||||
|
public final int ghostNumber; |
||||
|
|
||||
public Ghost(GameManager gameManager) { |
|
||||
this.gameManager = gameManager; |
|
||||
this.position = new Vector2(-1, -1); |
|
||||
} |
|
||||
|
|
||||
|
public Ghost(GameManager gameManager, int ghostNumber) { |
||||
|
this.gameManager = gameManager; |
||||
|
this.ghostNumber = ghostNumber; |
||||
|
this.position = new Vector2(-1, -1); |
||||
|
} |
||||
|
|
||||
|
public void setPosition(Vector2 newPosition) { |
||||
|
this.position = newPosition; |
||||
|
} |
||||
|
|
||||
|
public void move(Vector2 direction) { |
||||
|
this.position = this.position.Add(direction); |
||||
|
} |
||||
} |
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue