-
-
Save zachwlewis/579556 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
//Master.as | |
package | |
{ | |
public class Master | |
{ | |
public static var levelData:Vector.<DungeonWorld>; | |
public static var currentLevel:uint = 0; | |
} | |
} | |
//DungeonWorld.as | |
package | |
{ | |
import net.flashpunk.*; | |
import Master; | |
public class DungeonWorld extends World | |
{ | |
public function DungeonWorld() | |
{ | |
// If our global variables aren't instantiated yet, let's do that here. | |
if(Master.levelData == null) | |
{ | |
Master.levelData = new Vector.<DungeonWorld>; | |
} | |
else | |
{ | |
trace(Master.currentLevel); | |
} | |
} | |
override public function begin():void | |
{ | |
add(new Level()); | |
add(new Player(FP.screen.width/2,FP.screen.height/2)); | |
} | |
override public function end():void | |
{ | |
Master.levelData.push(this); | |
Master.currentLevel++; | |
super.end(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment