예제 #1
0
 public GameHandler()
 {
     scoreUpdated = true;
     character = new Character(0);
     platforms = new Platforms();
     obstacles = new Obstacles();
     spikes = new Obstacles();
     //pointers = new Pointers();
     projectiles = new Projectiles();
     coins = new Coins();
     bg1 = new Background(0, 0, Background.NORMAL);
     bg2 = new Background(1512, 0, Background.NORMAL);
     sky = new Background(0, 0, Background.FAR);
     sky2 = new Background(1512, 0, Background.FAR);
     sky.setSpeed(-1, 0);
     sky2.setSpeed(-1, 0);
     platforms.addPlatform(0, Platform.DEFAULT_GROUND_Y, Platform.SIZE_TYPE_4);
     platforms.addPlatform(platforms.getLast().getBound().Right, Platform.DEFAULT_GROUND_Y, Platform.SIZE_TYPE_4);
     delayProjectiles = 0; delayCoins = 0; delayObstacles = 0;
     motionTime = 0;
     addMotionTime = false;
     state = GameHandler.STATE_ALIVE;
     hero = new Animation(Animation.DEPENDENT_SPEED);
     flipHero = new Animation(Animation.DEPENDENT_SPEED);
     freeze = false;
     random = new Random();
     motionEffect = new Animation(Animation.INDEPENDENT_SPEED);
     DELAY_MIN_PRO=2000;
     DELAY_MAX_PRO = 5000;
     isf = IsolatedStorageFile.GetUserStoreForApplication();
     try
     {
         srLevel = new StreamReader(new IsolatedStorageFileStream("Data\\level.sav", FileMode.Open, isf));
         sLevel = srLevel.ReadLine();
         elapsedX = Convert.ToInt32(sLevel);
         sLevel = srLevel.ReadLine();
         obstaclesType = Convert.ToInt32(sLevel);
     }
     catch
     {
         elapsedX = -1;
         obstaclesType = -1;
     }
 }
예제 #2
0
 public void newLevel()
 {
     scoreUpdated = true;
     Game1.gameSpeed = 1;
     character = new Character(0);
     platforms = new Platforms();
     obstacles = new Obstacles();
     spikes = new Obstacles();
     //pointers = new Pointers();
     projectiles = new Projectiles();
     bg1 = new Background(0, 0, Background.NORMAL);
     bg2 = new Background(1512, 0, Background.NORMAL);
     sky = new Background(0, 0, Background.FAR);
     sky2 = new Background(1512, 0, Background.FAR);
     sky.setSpeed(-1, 0);
     sky2.setSpeed(-1, 0);
     coins = new Coins();
     platforms.addPlatform(0, Platform.DEFAULT_GROUND_Y, Platform.SIZE_TYPE_4);
     platforms.addPlatform(platforms.getLast().getBound().Right, Platform.DEFAULT_GROUND_Y, Platform.SIZE_TYPE_4);
     delayProjectiles = 0; delayCoins = 0; delayObstacles = 0;
     motionTime = 0;
     addMotionTime = false;
     state = GameHandler.STATE_ALIVE;
     freeze = false;
     DELAY_MIN_PRO=2000;
     DELAY_MAX_PRO = 5000;
 }