Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //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();
- }
- }
- }
Add Comment
Please, Sign In to add comment