public static void Initialize() { // Set up the graphics system graphics = new GraphicsContext (); // Background.cs initialization. background = new Background(graphics); // Fore ground foreground = new Foreground (graphics); // Create clock from System.Dianogstic clock = new Stopwatch(); clock.Start(); rand = new Random(); // rand.Next(-100, 230); this will perform random calculation. // Music. Bgm bgm = new Bgm("/Application/Resources/bgm.mp3"); // This will create a music based on the music file installed. bgmPlayer = bgm.CreatePlayer(); /* For this lines I experiencing problems is because * the sound file I manually import is not working well * with PSM sdk. It is there with some standard that will * that more time in configuring it. * **********************************************************/ Sound noise=new Sound("/Application/Resources/missile_shot.wav"); FireShots = noise.CreatePlayer(); Sound Explode=new Sound("/Application/Resources/explosion.wav"); Explosion = Explode.CreatePlayer(); /* Game start with game enumaration transition to states. * These lines below must be written after all of the initialization. * */ currentState = GameStates.Menu; // New games starts ^^ NewGame(); // Menu displays. Only once in initialize. Menus = new MenuDisplays(graphics); }
public static void UpdatePlays() { // Music plays from here. bgmPlayer.Loop = true; bgmPlayer.Volume = .62f; bgmPlayer.Play(); // Query gamepad for current state var gamePadData = GamePad.GetData (0); // Gamepad date invoke. Hero.Update(gamePadData); // Back ground update. background.Update(); // Fore ground update. foreground.Update(); // Alien handling. HandleAliens(); // Projectile handling. HandleProjectile(); // Dynamic label to tell Hero position, in connection // to HeroShip.cs in *get* value. hud.UpdatePosition("Position = " +Hero.X+ ":" +Hero.Y); ///Q.Text = "Position = " +Hero.X+ ":" +Hero.Y; // Time implementation. hud.UpdateFPS(TimeDelta); // Aliens counter in HUD. hud.UpdateAlienCount(Alienator.Count); // MIssiles counter from HUD. hud.UpdateMissileCount(missile.Count); // Explosion frame method. HandleExplosion(); // Shot timer update. ShotTimer += TimeDelta; // User Game over management. if(HeroEnemiesCollision()== true){ Menus = new MenuDisplays(graphics); currentState = GameStates.GameOver; } // Projectile button. if((gamePadData.Buttons & GamePadButtons.Cross)!= 0){ HandlingShots(); } if((gamePadData.Buttons & GamePadButtons.Circle)!= 0){ // Menus with graphics pass in. Menus = new MenuDisplays(graphics); currentState = GameStates.Paused; } }