/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.DeepSkyBlue); spriteBatch.Begin(); spriteBatch.Draw(background, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), Color.White); //if (gameTime.TotalGameTime.Seconds > Player1.GetAttack().GetComboStart() + 1 && Player1.GetAttack().GetComboStart() != 0) //{ // Console.WriteLine(Player1.GetAttack().GetClicked()); // Player1.GetAttack().Reset(); //} if ((Keyboard.GetState().IsKeyDown(Keys.Right))) { if (previousState.IsKeyUp(Keys.Right) && Player1.GetLastMove() == 'l') { Player1.StanceRight(spriteBatch); Player1.SetLastMove('r'); } else if (Keyboard.GetState().IsKeyDown(Keys.LeftShift)) { Player1.RunRight(spriteBatch); } else { Player1.WalkRight(spriteBatch); } } else if (Keyboard.GetState().IsKeyDown(Keys.Left)) { if (previousState.IsKeyUp(Keys.Right) && Player1.GetLastMove() == 'r') { Player1.StanceRight(spriteBatch); Player1.SetLastMove('l'); } else if (Keyboard.GetState().IsKeyDown(Keys.LeftShift)) { Player1.RunLeft(spriteBatch); } else { Player1.WalkLeft(spriteBatch); } } else if (Keyboard.GetState().IsKeyDown(Keys.Down)) { if (Player1.GetLastMove() == 'r') { Player1.CrouchRight(spriteBatch); } else { Player1.CrouchLeft(spriteBatch); } } else if (Keyboard.GetState().IsKeyDown(Keys.A) || Player1.IsInBasicCombo(gameTime)) { if (previousState.IsKeyUp(Keys.A) && Keyboard.GetState().IsKeyDown(Keys.A) && Player1.GetAttack().GetClicked() < Player1.GetAttack().GetComboLength() - 1) { Player1.GetAttack().SetClicked(Player1.GetAttack().GetClicked() + 1); } Player1.BasicCombo(spriteBatch, gameTime, Player1.GetAttack().GetClicked()); } else if ((Keyboard.GetState().IsKeyDown(Keys.B)) && (Keyboard.GetState().IsKeyDown(Keys.NumPad1)) && (Player1.GetSpecialAttTimer() + 10 < gameTime.TotalGameTime.Seconds)) { Player1.SpecialAttack(spriteBatch, gameTime); System.Threading.Thread.Sleep(25); } else // No key pressed { if (Player1.GetLastMove() == 'r') { Player1.StanceRight(spriteBatch); } else { Player1.StanceLeft(spriteBatch); } } spriteBatch.End(); previousState = Keyboard.GetState(); System.Threading.Thread.Sleep(75); base.Draw(gameTime); }