public CharacterAdjuster() { stunned = false; slowed = false; slept = false; incapped = false; impactLocation = ImpactLocations.None; }
public void GrabInput(InputAction inputAction, PlayerIndex playerIndex, int speed, bool stunned, bool slowed, bool slept, bool incapped, ImpactLocations impactLocation) { this.playerIndex = playerIndex; this.inputAction = inputAction; playerSpeed = speed; this.stunned = stunned; this.slowed = slowed; this.slept = slept; this.incapped = incapped; this.impactLocation = impactLocation; }
public void ResetPlayers(PlayerIndex playerIndex, int playerChoice) { this.playerChoice = playerChoice; slept = false; incapped = false; stunned = false; slowed = false; impactLocation = ImpactLocations.None; dashTrailTimer = 0; if (playerIndex == PlayerIndex.One) { playerLocation = new Vector2((graphics.PreferredBackBufferWidth / 2) - (playerAnimations.width / 2), graphics.PreferredBackBufferHeight - playerAnimations.height + 13); if (playerChoice == 1) { playerAnimations = new Animation(buffSpriteT, 6, 20); hitBox = new Rectangle((int)playerLocation.X + (playerAnimations.width / 2) - buffHitboxT.Width / 2, ((int)playerLocation.Y + playerAnimations.height / 2) - 20, buffHitboxT.Width, buffHitboxT.Height); reflectHitBox = new Rectangle((int)playerLocation.X + (playerAnimations.width / 2) - buffReflectBoxT.Width / 2, (int)playerLocation.Y + 25, buffReflectBoxT.Width, buffReflectBoxT.Height); } if (playerChoice == 2) { tiredreflectAnimation.currentFrame = -1; playerAnimations = new Animation(tiredSpriteT, 14, 10); hitBox = new Rectangle((int)playerLocation.X + (playerAnimations.width / 2) - tiredHitboxT.Width / 2, ((int)playerLocation.Y + playerAnimations.height / 2) - 19, tiredHitboxT.Width, tiredHitboxT.Height); reflectHitBox = new Rectangle((int)playerLocation.X + (playerAnimations.width / 2) - tiredReflectBoxT.Width / 2, (int)playerLocation.Y, tiredReflectBoxT.Width, tiredReflectBoxT.Height); } characterAdjuster.PassInCharacter(playerChoice); shotMeterLocation = new Vector2(hitBox.X + hitBox.Width / 2 - 15, hitBox.Y + 2 + hitBox.Height); } if (playerIndex == PlayerIndex.Two) { playerLocation = new Vector2((graphics.PreferredBackBufferWidth / 2) - (playerAnimations.width / 2), -5); if (playerChoice == 1) { playerAnimations = new Animation(buffSpriteT, 6, 20); hitBox = new Rectangle((int)playerLocation.X + (playerAnimations.width / 2) - buffHitboxT.Width / 2, (int)playerLocation.Y + (playerAnimations.width / 2) - 10, buffHitboxT.Width, buffHitboxT.Height); reflectHitBox = new Rectangle((int)playerLocation.X + (playerAnimations.width / 2) - buffReflectBoxT.Width / 2, (int)playerLocation.Y + playerAnimations.height - 50, buffReflectBoxT.Width, buffReflectBoxT.Height); } if (playerChoice == 2) { tiredreflectAnimation.currentFrame = -1; playerAnimations = new Animation(tiredSpriteT, 14, 10); hitBox = new Rectangle((int)playerLocation.X + (playerAnimations.width / 2) - tiredHitboxT.Width / 2, (int)playerLocation.Y + (playerAnimations.height / 2) - tiredHitboxT.Height / 2 + 7, tiredHitboxT.Width, tiredHitboxT.Height); reflectHitBox = new Rectangle((int)playerLocation.X + (playerAnimations.width / 2) - tiredReflectBoxT.Width / 2, (int)playerLocation.Y + playerAnimations.height - 30, tiredReflectBoxT.Width, tiredReflectBoxT.Height); } characterAdjuster.PassInCharacter(playerChoice); shotMeterLocation = new Vector2(hitBox.X + hitBox.Width / 2 - 15, hitBox.Y + 2 + hitBox.Height); } if (gameState == GameStates.SinglePlayer && playerIndex == PlayerIndex.Two) { AI = true; } shotMeterCounter = 30; slowLocation = new Vector2(hitBox.Center.X - slowEffect.width / 2, hitBox.Center.Y - slowEffect.height / 2); stunnedLocation = new Vector2(playerAnimations.width / 2 - stunnedEffect.width / 2, hitBox.Top - 20); sleepLocation = new Vector2(stunnedLocation.X, stunnedLocation.Y - 15); kickedUpDust.currentFrame = -1; landingPoof.currentFrame = -1; kickedUpDust.frameTime = 25; input.inputAction = InputAction.None; inputAction = InputAction.None; }
public Player(ControlType controlType, PlayerIndex playerIndex, GraphicsDeviceManager graphics, GameStates gameState) { characterAdjuster = new CharacterAdjuster(); this.graphics = graphics; this.playerIndex = playerIndex; this.gameState = gameState; impactLocation = ImpactLocations.None; if (this.gameState == GameStates.SinglePlayer && playerIndex == PlayerIndex.Two) { AI = true; } input = new Input(controlType, playerIndex, AI); health = 3; score = 0; playerSpeed = 5; potionType = PotionTypes.None; chargePotAnims1.Add(new Animation(chargePotAnimT1, 2, 3)); chargePotAnims1.Add(new Animation(chargePotAnimT2, 2, 3)); chargePotAnims1.Add(new Animation(chargePotAnimT3, 2, 3)); chargePotAnims1.Add(new Animation(chargePotAnimT4, 2, 3)); chargePotAnims1.Add(new Animation(chargePotAnimT5, 2, 3)); kickedUpDust = new Animation(kickedUpDustT, 3, 8); landingPoof = new Animation(landingPoofT, 3, 10); sleepEffect = new Animation(sleepEffectT, 1, 4); slowEffect = new Animation(slowEffectT, 2, 2); stunnedEffect = new Animation(stunnedEffectT, 2, 3); playerAnimations = new Animation(buffSpriteT, 6, 20); if (playerChoice == 1) { playerAnimations = new Animation(buffSpriteT, 6, 20); } if (playerChoice == 2) { playerAnimations = new Animation(tiredSpriteT, 14, 10); } if (playerIndex == PlayerIndex.One) { playerLocation = new Vector2((graphics.PreferredBackBufferWidth / 2) - (playerAnimations.width / 2), graphics.PreferredBackBufferHeight - playerAnimations.height + 13); reticalLocation = new Vector2((playerLocation.X + playerAnimations.width / 2), playerLocation.Y + playerAnimations.height / 2); } else if (playerIndex == PlayerIndex.Two) { playerLocation = new Vector2((graphics.PreferredBackBufferWidth / 2) - (playerAnimations.width / 2), -5); reticalLocation = new Vector2(playerLocation.X + (playerAnimations.width / 2), playerLocation.Y + playerAnimations.height / 2); if (AI == true) { aiRectangle = new Rectangle((int)playerLocation.X - 45, (int)playerLocation.Y, 120, hitBox.Height); } } tiredreflectAnimation = new Animation(tiredReflectT, 3, 10); tiredreflectAnimation.currentFrame = -1; tiredreflectAnimation.frameTime = 75; kickedUpDust.currentFrame = -1; landingPoof.currentFrame = -1; kickedUpDust.frameTime = 25; chargePotionAnimLocation = new Vector2(playerLocation.X + 35, playerLocation.Y + 45); chargePotAnims1[0].currentFrame = 0; chargePotAnims1[1].currentFrame = 6; chargePotAnims1[2].currentFrame = 6; chargePotAnims1[3].currentFrame = 6; chargePotAnims1[4].currentFrame = 6; shieldFrame = new Animation(shieldFrameT, 5, 12); shieldFrame.frameTime = 75; shieldFrame.currentFrame = 0; shieldPanels.Add(new Animation(panel1, 5, 12)); shieldPanels.Add(new Animation(panel2, 5, 12)); shieldPanels.Add(new Animation(panel3, 5, 12)); shieldPanels.Add(new Animation(panel4, 5, 12)); shieldPanels.Add(new Animation(panel5, 5, 12)); shieldPanels.Add(new Animation(panel6, 5, 12)); shieldPanels.Add(new Animation(panel7, 5, 12)); shieldPanels.Add(new Animation(panel8, 5, 12)); shieldPanels.Add(new Animation(panel9, 5, 12)); shieldPanels.Add(new Animation(panel10, 5, 12)); foreach (Animation shieldPanel in shieldPanels) { shieldPanel.frameTime = 75; shieldPanel.rainbow = true; } shieldPanels[0].r = 0; shieldPanels[0].g = 85; shieldPanels[0].b = 170; shieldPanels[1].r = 20; shieldPanels[1].g = 105; shieldPanels[1].b = 190; shieldPanels[2].r = 40; shieldPanels[2].g = 125; shieldPanels[2].b = 210; shieldPanels[3].r = 60; shieldPanels[3].g = 145; shieldPanels[3].b = 230; shieldPanels[4].r = 80; shieldPanels[4].g = 165; shieldPanels[4].b = 250; shieldPanels[5].r = 100; shieldPanels[5].g = 185; shieldPanels[5].b = 15; shieldPanels[6].r = 120; shieldPanels[6].g = 205; shieldPanels[6].b = 35; shieldPanels[7].r = 140; shieldPanels[7].g = 225; shieldPanels[7].b = 55; shieldPanels[8].r = 160; shieldPanels[8].g = 245; shieldPanels[8].b = 75; shieldPanels[9].r = 180; shieldPanels[9].g = 10; shieldPanels[9].b = 95; shieldLocation = new Vector2(playerAnimations.drawingLocation.X + playerAnimations.width / 2 - shieldFrame.width / 2, playerAnimations.drawingLocation.Y + playerAnimations.height / 2 - shieldFrame.height / 2 + 5); shieldHitbox = new Rectangle((int)shieldLocation.X, (int)shieldLocation.Y, shieldFrame.width, shieldFrame.height); }