Game Development Reference
In-Depth Information
The original play button should be drawn in front of the background. It should be under-
neath the
background
node in the Timeline. If it's not, drag the play button downward in
the Timeline to change the draw order.
After you publish the project, you can run Xcode and try it out—though it's a bit awkward
to go through the pause menu and then exit the game to the main menu. Open
AppDeleg-
ate.m
, and locate the
startScene
method. Then change the line it contains so that it
loads
MainScene.ccb
, as seen in
Listing 7-1
.
Listing 7-1
.
Launching the app with MainScene.ccb
-(CCScene*) startScene
{
return [CCBReader loadAsScene:@“MainScene"];
}
The game will now launch with the
MainScene
, but it's still missing the logo and buttons.
Main Scene Logo and Buttons
Let's add some buttons and the logo. Since the button images
play.png
and
settings.png
from the Menu Sprite Sheet should have a rotation animation, you need to get a little cre-
ative regarding how they work as buttons.
Also, you'll want to use the Timeline Chain to have an intro sequence where the buttons
come flying in from the side of the screen.
Designing Logo and Buttons
But first things first. Once more, create a new CCB file for the buttons. Right-click the
UserInterface
folder and select
New File
. Name the document
MainMenuButtons.ccb
,
make it a
Layer
, leave the default size, and click
Create
. You should probably change the
stage color right away, too. Go to
Document
Stage Color
White
to better see the
images.
Again, the first thing to do on a Layer CCB is to select the root node and change its
Con-
tent size
types to
%
with values of
100
to ensure proper scaling and centering.
Search WWH ::
Custom Search