Game Development Reference
In-Depth Information
Don't forget to set the selector on the Item Code Connections , and enter shouldLoadNex-
tLevel in the Selector field. That completes the wonderfully minimalistic Level Complet e
popover seen in Figure 8-9 .
Figure 8-9 . Level complete: Everything is awesome
Tip If you want to make this popover more complete, consider adding retry
and exit buttons to it. After all, the popover uses the same GameMenuLayer
class as the other popovers, so it's only a matter of connecting the button's se-
lectors to shouldRestartGame and shouldExitGame .
Back to Xcode. You'll want to show this popover when the player collides with the exit
object. Open GameScene.m , and import the GameState header by adding the high-
lighted line in Listing 8-16 just below the other import lines.
Listing 8-16 . Importing the GameState header
#import "GameScene.h"
#import "Trigger.h"
#import "GameMenuLayer.h"
#import "GameState.h"
Then locate the physics collision method with player and exit as parameters, and re-
place it with the version in Listing 8-17 .
Search WWH ::




Custom Search