Game Development Reference
In-Depth Information
LearnSpriteBuilder[67794:60b] scroll view: <CCScrollView
= 0x9b54490 | Name = >
If there is still a
playButtonPressed
method in
MainScene
, you can remove that.
also check if
MainScene.ccb
still contains that button. If it does, you can remove that as
well. If you remove the button and its selector code, you won't be able to play the first
level for now, but you'll add this functionality back in shortly.
For now, you don't need to do anything further with the
CCScrollView
ivar, but it will
be used shortly to explain how to react to certain
Scroll View
events.
Next, create a new Cocoa Touch Class as shown in
Figure 2-10
and 2-11. Name the class
MainMenuLevelSelect
, and make it a subclass of
CCNode
. Once the class is created,
open the
MainMenuLevelSelect.h
and add the code highlighted in
Listing 8-2
.
Listing 8-2
.
MainMenuLevelSelect header
#import "CCNode.h"
@class MainMenuButtons;
@interface MainMenuLevelSelect : CCNode
@property (weak) MainMenuButtons* mainMenuButtons;
@end
The additions are analogous to those in
SettingsLayer
, enabling the
MainMenuButtons
class to assign itself to the
MainMenuLevelSelect
class so
that it can send messages back to it. You'll need it only for closing the level-selection pop-
over, just like you did in
SettingsLayer
, too.
MainMenuLevelSelect.m
does not need any modifications for now.
MainMenuButtons.m
, on the other hand, requires several additions. Add the code high-
lighted in
Listing 8-3
.
Listing 8-3
.
Excerpt of MainMenuButtons.m with new additions highlighted
#import "MainMenuButtons.h"
#import "SettingsLayer.h"
#import "MainMenuLevelSelect.h"
@implementation MainMenuButtons
{
Search WWH ::
Custom Search