protected override void Initialize() { base.Initialize(); CreateHighScoreFile(); AssetManager.Load(Content, GraphicsDevice); GameObjectManager.Add(new Player()); //GameObjectManager.Add(new PowerUp(new Vector2(200, 0), 4)); //GameObjectManager.Add(new PowerUp(new Vector2(400, 0), 4)); // GameObjectManager.Add(new Ship(new Vector2(300, 100), 0, 3, 128)); //GameObjectManager.Add(new Drone(new Vector2(0, 0), -1, -180)); //GameObjectManager.Add(new BigRobot(new Vector2(400, 0), 200)); //Globals.gameOver = true; menuState = MenuState.start; userInterface = new UserInterface(); }
protected override void Update(GameTime gameTime) { prevKeyboard = keyboard; keyboard = Keyboard.GetState(); if (menuState == MenuState.start) { if (keyboard.IsKeyDown(Keys.OemBackslash) || keyboard.IsKeyDown(Keys.Enter)) { menuState = MenuState.game; } if (keyboard.IsKeyDown(Keys.Z) && keyboard.IsKeyDown(Keys.OemPeriod)) { this.Exit(); } } if (menuState == MenuState.game) { GameObjectManager.Update(); if (Globals.gameOver && keyboard.IsKeyDown(Keys.X)) { GameObjectManager.gameObjects.Clear(); GameObjectManager.Add(new Player()); spawnManager = new SpawnManager(); userInterface = new UserInterface(); Globals.gameOver = false; } // Star if (Globals.Randomizer.Next(0, 101) < 5) { GameObjectManager.Add(new Star()); } spawnManager.Update(); userInterface.Update(); } base.Update(gameTime); }