public void changeScreen(ScreenType screen) { switch (screen) { case ScreenType.AboutScreen: currentScreen = aboutScreen; break; case ScreenType.MainMenuScreen: currentScreen = mainMenuScreen; break; case ScreenType.PauseScreen: currentScreen = pauseScreen; break; case ScreenType.TutorialScreen: currentScreen = tutorialScreen; break; case ScreenType.GameScreen: currentScreen = gameScreen; break; case ScreenType.GameOverScreen: currentScreen = gameOverScreen; break; } }
protected override void Initialize() { /* graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft; graphics.PreferredBackBufferHeight = 480; graphics.PreferredBackBufferWidth = 800; graphics.ApplyChanges(); */ textureHandler = new TextureHandler(GraphicsDevice); gameScreen = new GameScreen(this, textureHandler); pauseScreen = new PauseScreen(this, textureHandler); loadScreen = new LoadScreen(this, textureHandler); gameOverScreen = new GameOverScreen(this, textureHandler); mainMenuScreen = new MainMenuScreen(this, textureHandler); aboutScreen = new AboutScreen(this, textureHandler); tutorialScreen = new TutorialScreen(this, textureHandler); currentScreen = loadScreen; initializeAccelerometer(); base.Initialize(); }
protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); if (gameScreen.getHumptyDumpty().Status == HumptyDumpty.DEAD) currentScreen = gameOverScreen; TouchCollection tc = TouchPanel.GetState(); if (currentScreen is GameScreen) ((GameScreen)currentScreen).Update(gameTime, tc, acceleration); else if (currentScreen is LoadScreen && ((LoadScreen)currentScreen).isFinishedLoading()) currentScreen = mainMenuScreen; else currentScreen.Update(gameTime, tc); base.Update(gameTime); }
public void playAgain() { currentScreen = gameScreen; gameScreen.ResetGame(); }