Game Development Reference
In-Depth Information
The buttons could use some text on them because the images alone do not really convey
meaning. From the Node Library View, drag one Label TTF node onto the play sprite, and
then drag another Label TTF onto the settings sprite. The labels should be child nodes of
the play and sprite nodes, respectively.
For both labels, you first select the label and then change its position type to % and value
to 50 . This centers the label on the respective sprite. Then enter appropriate Label
text —for example, PLAY (all caps) for the play label and Settings for the settings label.
The play label could use a Font size of 20, while the settings label allows for no more than
Font size 16 if the text is not supposed to draw beyond the gear image. The result should
look similar to Figure 7-5 .
Animating Logo and Buttons
Animating will be a tad more interesting this time. You'll create an intro Timeline that
moves the logo and buttons in place, before they start rotating.
Left-click the Timeline List (as shown in Figure 5-1 in Chapter 5 ) , and select Edit
Timelines to bring up the dialog shown in Figure 5-9 . Click the + button to create a
second Timeline and name it loop . Double-click Default Timeline in the list to change its
name to entry . Leave the Autoplay check box as is. Then click Done .
The goal is to have the entry animation play automatically. The entry animation is then
chained to run the loop animation, while the loop animation is chained to itself to loop
forever. Overall, this is a very convenient way to create a looping animation with a one-
time entry animation. Let's set this up first.
The Timeline List should read entry , showing that the entry Timeline is selected. If it's
not, left-click the Timelines List and select the entry Timeline.
At the bottom of the Timeline, left-click No chained timeline and set it to loop . Left-click
on the Timeline List again and, from the Timelines submenu, choose the loop animation.
Again, at the bottom where it says No chained timeline , perform a left-click and select
loop . This will properly chain the entry Timeline to loop , and loop on itself to repeat
forever.
Note SpriteBuilder will not play back chained Timelines in sequence.
SpriteBuilder will play only the currently selected Timeline, and optionally loop
it. To test chained Timelines, you'll have to actually run the app.
Search WWH ::




Custom Search