Game Development Reference
In-Depth Information = score;
The main document serves two primary functions for Marble
Runner. It is used to change screens, which is done when a screen
dispatches a DataEvent of the type
Although bubbling an
event up to the root level clip like this is not at all advisable in
performance-sensitive areas like playing the actual game, it
fine when navigating between static menu screens. The other pur-
pose of the document class is to save the user
s progress, so if they
have to take a call or otherwise unexpectedly quit from the game,
they can return to it later. This is done through the use of a Shared-
Object , which you may be familiar with if you
ve ever used it in the
desktop version of Flash to save small pieces of data to use later. In
this case, we store the current level the player is on and their score
at the time. Next, we
ll look at the title screen where this is first used.
The title screen simply consists of some buttons and the game
previous game, see how to play the game, or view the leaderboard
(see Fig. 15.9 ).
final public class Title extends Sprite
public var btnNewGame:SimpleButton;
public var btnContinueGame:SimpleButton;
public var btnHowToPlay:SimpleButton;
public var btnLeaderboard:SimpleButton;
public function Title()
onAddedToStage, false, 0, true);
private function onAddedToStage(e:Event):void
onNewGame, false, 0, true);
CLICK, onContinueGame, false, 0, true);
onHowToPlay, false, 0, true);
Figure 15.9 The title screen of
Marble Runner.
Search Nedrilad ::

Custom Search