Game Development Reference
In-Depth Information
private function levelComplete():void
_score += (LEVEL_LENGTH - _timer.currentCount) *
tfScore.text = _score.toString();
dispatchEvent(new DataEvent(MarbleRunner.EVENT_NAVIGATE,
true, false, MarbleRunner.FRAME_RESULTS));
private function onTimer(e:TimerEvent):void
var currentTime:int = LEVEL_LENGTH - Timer(
tfTime.text = timeToString(currentTime);
private function onTimerComplete(e:TimerEvent):void
private function timeToString(time:int):String
var timeStr:String = Math.floor(time / 60).toString();
timeStr += " : " ;
var seconds:String = " 0 " + (time % 60);
seconds = seconds.substr(-2);
timeStr += seconds;
return timeStr;
Every level clip is a class that extends LabyrinthLevel, which we
examined earlier. In the XFL document library, you can find each
of these levels, exported as Level1, Level2, etc. Since we
re not add-
ing any custom functionality, these classes will be generated auto-
matically by Flash on export. When nextLevel is called in the
GameClip, it concatenates
with the current level number
and looks up the class definition. This and the Marble class we
look at shortly are then passed to a new instance of the Labyr-
inthEngine class. The engine instance is offset 20 pixels down from
Search Nedrilad ::

Custom Search