From 3fa12134d08665648899f133e2786920a3783ec7 Mon Sep 17 00:00:00 2001 From: fdai7012 Date: Thu, 8 Feb 2024 17:38:20 +0100 Subject: [PATCH] refactoring: combined both ghost move functions into one --- src/main/java/pacmanGame/Ghost.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/pacmanGame/Ghost.java b/src/main/java/pacmanGame/Ghost.java index 7884171..288b150 100644 --- a/src/main/java/pacmanGame/Ghost.java +++ b/src/main/java/pacmanGame/Ghost.java @@ -17,14 +17,11 @@ public class Ghost { this.position = newPosition; } - public void move(Vector2 direction) { - this.position = this.position.Add(direction); - } - public void spawn() { this.position = gameManager.map.ghostSpawns[ghostNumber].Clone(); } + public void move() { - move(behavior.GetDirection(this)); + this.position = this.position.Add(behavior.GetDirection(this)); } }