File tree Expand file tree Collapse file tree 3 files changed +12
-7
lines changed
pacman-core/src/main/java/de/amr/pacmanfx Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ public void onUpdate(GameContext context) {
81
81
static final short TICK_NEW_GAME_SHOW_GUYS = 120 ;
82
82
static final short TICK_NEW_GAME_START_HUNTING = 240 ;
83
83
static final short TICK_DEMO_LEVEL_START_HUNTING = 120 ;
84
- static final short TICK_RESUME_GAME = 90 ;
84
+ static final short TICK_RESUME_HUNTING = 90 ;
85
85
86
86
@ Override
87
87
public void onEnter (GameContext context ) {
@@ -91,13 +91,9 @@ public void onEnter(GameContext context) {
91
91
@ Override
92
92
public void onUpdate (GameContext context ) {
93
93
if (context .game ().isPlaying ()) {
94
- // resume running game
95
94
if (timer .tickCount () == 1 ) {
96
- context .game ().resetPacManAndGhostAnimations ();
97
- context .gameLevel ().getReadyToPlay ();
98
- context .gameLevel ().showPacAndGhosts ();
99
- context .eventManager ().publishEvent (GameEventType .GAME_CONTINUED );
100
- } else if (timer .tickCount () == TICK_RESUME_GAME ) {
95
+ context .game ().continueGame ();
96
+ } else if (timer .tickCount () == TICK_RESUME_HUNTING ) {
101
97
context .gameController ().changeGameState (GameState .HUNTING );
102
98
}
103
99
}
Original file line number Diff line number Diff line change @@ -75,6 +75,14 @@ public Optional<GameLevel> level() {
75
75
return Optional .ofNullable (level );
76
76
}
77
77
78
+ @ Override
79
+ public void continueGame () {
80
+ resetPacManAndGhostAnimations ();
81
+ level .getReadyToPlay ();
82
+ level .showPacAndGhosts ();
83
+ eventManager ().publishEvent (GameEventType .GAME_CONTINUED );
84
+ }
85
+
78
86
@ Override
79
87
public void startHunting () {
80
88
level .pac ().playAnimation ();
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ public interface GameLifecycle {
11
11
void prepareForNewGame ();
12
12
boolean canStartNewGame ();
13
13
void startNewGame ();
14
+ void continueGame ();
14
15
void buildNormalLevel (int levelNumber );
15
16
void buildDemoLevel ();
16
17
void createLevel (int levelNumber );
You can’t perform that action at this time.
0 commit comments