Skip to content

Commit 2734942

Browse files
Refac
1 parent 60c6551 commit 2734942

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

pacman-app-arcade-pacman/src/main/java/de/amr/pacmanfx/arcade/pacman/ArcadeCommon_GameModel.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
import de.amr.pacmanfx.model.GameLevel;
1313
import de.amr.pacmanfx.model.GateKeeper;
1414
import de.amr.pacmanfx.model.MapSelector;
15+
import de.amr.pacmanfx.model.actors.CommonAnimationID;
1516
import de.amr.pacmanfx.model.actors.Ghost;
17+
import de.amr.pacmanfx.model.actors.GhostState;
1618
import de.amr.pacmanfx.steering.Steering;
1719
import org.tinylog.Logger;
1820

@@ -92,7 +94,8 @@ public void onGhostKilled(Ghost ghost) {
9294
int killedSoFar = level.victims().size();
9395
int points = 100 * KILLED_GHOST_VALUE_FACTORS[killedSoFar];
9496
level.victims().add(ghost);
95-
ghost.eaten(killedSoFar);
97+
ghost.setState(GhostState.EATEN);
98+
ghost.selectAnimation(CommonAnimationID.ANIM_GHOST_NUMBER, killedSoFar);
9699
scoreManager().scorePoints(points);
97100
Logger.info("Scored {} points for killing {} at tile {}", points, ghost.name(), ghost.tile());
98101
level.registerGhostKilled();

pacman-app-arcade-pacman/src/test/java/TestEatingFood.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static void setup() {
2121

2222
@BeforeEach
2323
public void createGameLevel() {
24-
theGameContext().game().buildNormalLevel(theGameContext(), 1);
24+
theGameContext().game().buildNormalLevel(1);
2525
}
2626

2727
private GameLevel gameLevel() { return theGameContext().gameLevel(); }

pacman-app-tengen-mspacman/src/main/java/de/amr/pacmanfx/tengen/ms_pacman/model/TengenMsPacMan_GameModel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,8 @@ public void onGhostKilled(Ghost ghost) {
733733
int killedSoFar = level.victims().size();
734734
int points = 100 * KILLED_GHOST_VALUE_FACTORS[killedSoFar];
735735
level.victims().add(ghost);
736-
ghost.eaten(killedSoFar);
736+
ghost.setState(GhostState.EATEN);
737+
ghost.selectAnimation(CommonAnimationID.ANIM_GHOST_NUMBER, killedSoFar);
737738
scoreManager.scorePoints(points);
738739
Logger.info("Scored {} points for killing {} at tile {}", points, ghost.name(), ghost.tile());
739740
}

pacman-core/src/main/java/de/amr/pacmanfx/model/actors/Ghost.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,6 @@ public void tick(GameContext gameContext) {
256256
}
257257
}
258258

259-
public void eaten(int index) {
260-
setState(GhostState.EATEN);
261-
selectAnimation(ANIM_GHOST_NUMBER, index);
262-
}
263-
264259
// --- LOCKED ---
265260

266261
/**

0 commit comments

Comments
 (0)