-
-
Save jonahvsweb/4662025 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //In your Main class : | |
| public function Main() { | |
| levelManager = new LevelManager(ALevel); | |
| levelManager.onLevelChanged.add(_onLevelChanged); | |
| levelManager.levels = [[Level1, "levels/A1/LevelA1.swf"], [Level2, "levels/A2/LevelA2.swf"]]; | |
| levelManager.gotoLevel(); | |
| } | |
| private function _onLevelChanged(lvl:ALevel):void { | |
| state = lvl; | |
| lvl.lvlEnded.add(_nextLevel); | |
| lvl.restartLevel.add(_restartLevel); | |
| } | |
| private function _nextLevel():void { | |
| levelManager.nextLevel(); | |
| } | |
| private function _restartLevel():void { | |
| state = levelManager.currentLevel as IState; | |
| } | |
| //Note that you should create an abstract clas : Level1 and Level2 extends ALevel which extends the State class. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment