Game Development Reference
In-Depth Information
_platformer.init(_config);
_platformer.loadLevel( " level " +_level+ " .
xml " );
_platformer.addEventListener(Progress
Event.PROGRESS, loadProgress, false, 0,
true);
_platformer.addEventListener(Platformer
Event.ASSET_LOAD_COMPLETE, loadComplete,
false, 0, true);
_platformer.addEventListener(Platformer
Event.ENTER_PORTAL, levelComplete,
false, 0, true);
_platformer.addEventListener(Platformer
Event.PLAYER_DIE, playerDied, false, 0,
true);
_platformer.addEventListener(Platformer
Event.INVENTORY_UPDATE, inventoryUpdate,
false, 0, true);
}
private function loadProgress(e:ProgressEvent):
void {
percentText.text = Math.round(100 *
(e.bytesLoaded/e.bytesTotal)) + " % " ;
}
private function loadComplete(e:PlatformerEvent):
void {
loadingText.visible = false;
percentText.visible = false;
addChild(_platformer);
_platformer.startGame();
}
private function levelComplete(e:PlatformerEvent) {
if (e.data = PortalDestinations.
NEXT_LEVEL) {
_platformer.stopGame();
trace(
"
GAME OVER:
"
,_platformer.
);
_previousScore = _platformer.
inventoryWorth;
_platformer.destroy();
removeChild(_platformer);
nextLevel();
inventoryWorth,
"
points
"
}
}
Search Nedrilad ::




Custom Search