public static void UpdatePlaying() { var gamePadData = GamePad.GetData(0); foreach (GameObj g in pieces) if(g.isAlive ()) //If an object has been killed, it should not update. { g.Update (); } scoreLabel.Text = "Score: " + score; //Allows the player to restart. if(gameOver == true) { menuDisplay = new MenuDisplay(graphics); currentGameState = GameState.Dead; } if(score % 10 == 0 && !newLevel) { NewGame (score); } }
public static void UpdateMenu() { var gamePadData = GamePad.GetData(0); if((gamePadData.Buttons & GamePadButtons.Enter) != 0) { NewGame(0); currentGameState = GameState.Playing; } if((gamePadData.Buttons & GamePadButtons.Select) != 0) { menuDisplay = new MenuDisplay(graphics); currentGameState = GameState.HighScoreView; } if((gamePadData.Buttons & GamePadButtons.Back) != 0) { currentGameState = GameState.Quit; } }
public static void UpdateHighScoreView() { var gamePadData = GamePad.GetData(0); if((gamePadData.Buttons & GamePadButtons.Enter) != 0) { menuDisplay = new MenuDisplay(graphics); currentGameState = GameState.Menu; } }
public static void UpdateHighScoreAdd() { var gamePadData = GamePad.GetData(0); DrawHUD (); float pos = selector.Position.X; if((gamePadData.Buttons & GamePadButtons.Right) != 0) { if(pos <= 781) { selector.Position.X += 2.65f; } } if((gamePadData.Buttons & GamePadButtons.Left) != 0) { if(pos >= 252.4) { selector.Position.X -= 2.65f; } } if((gamePadData.Buttons & GamePadButtons.Enter) != 0) { if (coolDown <= 0) { if(holder.Length < 3) { holder += GetLetterAt(selector.Position.X); coolDown = 10; } else { UpdateHighScore(); } } } if((gamePadData.Buttons & GamePadButtons.Select) != 0) { UpdateHighScore(); menuDisplay = new MenuDisplay(graphics); currentGameState = GameState.Menu; } if((gamePadData.Buttons & GamePadButtons.Back) != 0) { UpdateHighScore(); currentGameState = GameState.Quit; } coolDown--; }
public static void UpdateDead() { var gamePadData = GamePad.GetData(0); if((gamePadData.Buttons & GamePadButtons.Enter) != 0) { menuDisplay = new MenuDisplay(graphics); currentGameState = GameState.Menu; } if((gamePadData.Buttons & GamePadButtons.Back) != 0) { currentGameState = GameState.Quit; } }
public static void Initialize() { clock = new Stopwatch(); clock.Start(); backgroundMusic = new Bgm("/Application/assets/music.mp3"); backgroundPlayer = backgroundMusic.CreatePlayer(); backgroundPlayer.Loop = true; backgroundPlayer.Play(); presentSound = new Sound("/Application/assets/jinglebell.wav"); presentSoundPlayer = presentSound.CreatePlayer(); isPlaying = true; // Set up the graphics system graphics = new GraphicsContext (); gen= new Random(); NewGame(0); currentGameState = GameState.Menu; menuDisplay = new MenuDisplay(graphics); }