Game Development Reference
In-Depth Information
frameRateProfiler = new FrameRateProfiler();
frameRateProfiler.profilerRenderObjects = 4000;
frameRateProfiler.profilerRenderLoops = 7;
frameRateProfiler.profilerDisplayOnScreen= true;
frameRateProfiler.profilerXLocation = 0;
frameRateProfiler.profilerYLocation = 0;
addChild(frameRateProfiler);
frameRateProfiler.startProfile(frameRate);
frameRateProfiler.addEventListener(FrameRateProfiler.EVENT_COMPLETE,
frameRateProfileComplete, false, 0, true);
}
override public function frameRateProfileComplete(e:Event):void {
trace("profiledFrameRate=" + frameRateProfiler.profilerFrameRateAverage);
game.setRendering(frameRateProfiler.profilerFrameRateAverage, frameRate);
game.timeBasedUpdateModifier = frameRate;
removeEventListener(FrameRateProfiler.EVENT_COMPLETE, frameRateProfileComplete) ;
removeChild(frameRateProfiler);
//frame counter
frameCounter.x = 400;
frameCounter.y = 200;
frameCounter.profiledRate = frameRateProfiler.profilerFrameRateAverage;
frameCounter.showProfiledRate = true;
addChild(frameCounter);
startTimer(true);
}
override public function systemGamePlay():void {
game.runGameTimeBased(paused,timeDifference);
}
override public function systemTitle():void {
soundManager.playSound(SOUND_MUSIC_TITLE, true,999, 20, 1);
super.systemTitle();
}
override public function systemNewGame():void {
trace("new game");
soundManager.stopSound(SOUND_MUSIC_TITLE,true);
super.systemNewGame();
}
override public function systemLevelIn():void {
levelInScreen.alpha = 1;
super.systemLevelIn();
}
override public function systemWait():void {
//trace("system Level In");
if (lastSystemState == FrameWorkStates.STATE_SYSTEM_LEVEL_IN) {
Search WWH ::




Custom Search