Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Jun 14th, 2018 57 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. //Master.as
  2.  
  3. package  
  4. {
  5.     public class Master
  6.     {
  7.         public static var levelData:Vector.<DungeonWorld>;
  8.         public static var currentLevel:uint = 0;
  9.     }
  10. }
  11.  
  12.  
  13. //DungeonWorld.as
  14.  
  15. package
  16. {
  17.     import net.flashpunk.*;
  18.     import Master;
  19.  
  20.     public class DungeonWorld extends World
  21.     {
  22.        
  23.         public function DungeonWorld()
  24.         {
  25.             // If our global variables aren't instantiated yet, let's do that here.
  26.             if(Master.levelData == null)
  27.             {
  28.                 Master.levelData = new Vector.<DungeonWorld>;
  29.             }
  30.             else
  31.             {
  32.                 trace(Master.currentLevel);
  33.             }
  34.         }
  35.        
  36.         override public function begin():void
  37.         {
  38.             add(new Level());
  39.             add(new Player(FP.screen.width/2,FP.screen.height/2));
  40.         }
  41.        
  42.         override public function end():void
  43.         {
  44.             Master.levelData.push(this);
  45.             Master.currentLevel++;
  46.             super.end();
  47.         }
  48.     }
  49.  
  50. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top