Time for action – having the game over scene show up
To incorporate the game over scene into the game, use the following steps:
Switch to the
Battlefield.h
file.Remove both the
textGameWon
andtextGameLost
properties.Switch to the
Battlefield.m
file.Remove all references to the
textGameWon
andtextGameLost
properties.In the
GameOver.m
file, add areset
method using the following code:-(void) reset { self.gameWon = NO; }
In the
SceneDirector.h
file, add a property calledcurrentScene
using the following code:@property (readonly) Scene *currentScene;
In the
SceneDirector.m
file, update theshowScene
method to set thecurrentScene
property, as shown in the following code:-(void) showScene:(NSString *)name { for (NSString* sceneName in _dict) { ((Scene *) _dict[sceneName]).visible = false; [((Scene *) _dict[sceneName]) stop]; } if (_dict[name] != nil) { ((Scene *) _dict[name]).visible = YES; [((Scene *) _dict[name]) reset]; _currentScene...