/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { //Get the new keyboard/gamepad state currentKeyState = Keyboard.GetState(); currentPadState = GamePad.GetState(PlayerIndex.One); //Only update game functions if we are in game //i.e. note start/end screen or paused if ((gameState == 2) && (!gamePaused) && (!gameOverDeath)) { /// /// UPDATE GAME FUNCTIONS /// //Update Character Movement heroCharacter.Update(); //Update Enemy Character movements UpdateEnemyMovements(); //Check for collisions between the hero and any enemies //Also enemies and of the hero's attacks CollisionChecking(); //Update any attacks and remove them from screen UpdateAttacks(); UpdateBossAttacks(); //Update enemies that are dead UpdateEnemyHealth(); //Update whatever room we are in UpdateRoomCheck(gameTime); //Check to see if the hero has lost all his health i.e. game over CheckHeroHealth(); //Update Camera CheckCameraChange(); mainCam.Update(); } //Check for key presses to start or unpause CheckKeyboardChanges(); //Update Last Key State oldKeyState = currentKeyState; oldPadState = currentPadState; base.Update(gameTime); }