public Vector2 TurnEnemyToBunny() { if (CurrentState != EnemyState.Bunny) { CurrentState = EnemyState.Bunny; Height /= 2; Width = 2; Texture = "flower"; XNACS1Base.PlayACue("transform"); } return(Center); }
public void Shoot(XNACS1Rectangle hero) { shot s = new shot(hero.Center, false); s.bullet.ShouldTravel = true; s.bullet.Velocity = (XNACS1Base.GamePad.ThumbSticks.Right.X == 0 && XNACS1Base.GamePad.ThumbSticks.Right.Y == 0) ? new Vector2(hero.Texture == "pennyRight" ? 1 : -1, 0) : XNACS1Base.GamePad.ThumbSticks.Right; list.Add(s); XNACS1Base.PlayACue("spell"); //shot s2 = new shot(hero.Center, false); //s2.bullet.ShouldTravel = true; //s2.bullet.Velocity = s.bullet.Velocity; //s2.bullet.VelocityY = 0.25f; //list.Add(s2); }
public Vector2 TurnEnemyToBunny() { if (CurrentState != EnemyState.Bunny) { CurrentState = EnemyState.Bunny; Width = 4.7f; Height = 2.5f; SetTextureSpriteSheet("bunnySpriteSheet", 11, 2, 0); UseSpriteSheet = true; SetTextureSpriteAnimationFrames(0, 0, 10, 1, 5, SpriteSheetAnimationMode.AnimateForward); UseSpriteSheetAnimation = true; string[] cues = { "transform1", "transform2", "transform3", "transform4" }; Random r = new Random(); XNACS1Base.PlayACue(cues[r.Next(0, 4)]); } return(Center); }
public Vector2 updateRoom(Hero hero, int levelNum) { heroCaught = false; walls.UpdateWallCollisionWithHero(hero); for (int i = 0; i < myEnemies.Length; i++) { bool temp = myEnemies[i].UpdateEnemy(hero, walls); if (temp) { heroCaught = temp; } walls.UpdateWallCollisionWithEnemy(myEnemies[i]); } walls.updateStatus(hero, levelNum); if ((XNACS1Base.GamePad.Triggers.Right > 0 && !triggerPressed) || XNACS1Base.GamePad.ButtonXClicked()) { wand.Shoot(hero); triggerPressed = true; } if (XNACS1Base.GamePad.Triggers.Right == 0) { triggerPressed = false; } dropPos = wand.Update(myEnemies, walls); if (dropPos.X > -1) { reduceActiveEnemies(); } //allDone = true; //for (int i = 0; i < myEnemies.Length; i++) { // if (!myEnemies[i].isBunny()) // allDone = false; //} if (hasStairs == 1 && badGuy != null) { walls.updateWizardStats(badGuy); hasWon = badGuy.Update(hero, wand); if (hasWon) { stairs.AddToAutoDrawSet(); stairs.available = true; openAllDoors(); } if (badGuy.heroHit) { heroCaught = true; } } if (key != null) { if (hero.Collided(key)) { openAllDoors(); XNACS1Base.PlayACue("door_open"); key.RemoveFromAutoDrawSet(); } if (myDoors[0].isOpen() && key != null) { key.RemoveFromAutoDrawSet(); key = null; } } Vector2 newRoom = new Vector2(-1f, -1f); for (int i = 0; i < numDoors; i++) { newRoom = myDoors[i].UpdateDoor(hero); if (newRoom.X > 0f) { return(newRoom); } } return(newRoom); }
public bool Update(Hero hero, Wand w) { heroHit = false; health.Update(new Vector2(this.Center.X, this.Center.Y + 1), healthRemaining, initialLives); if (current == wizardStatus.isAlive) { if (shieldCoolDown < 0 && !shielded) { shielded = true; shieldCoolDown = 100; } else { shieldCoolDown--; } if (shieldCoolDown < 0 && shielded) { shielded = false; shieldCoolDown = 100; } if (shielded) { Texture = "wizardShield"; } else { Texture = "wizardRight"; if (coolDown < 0) { coolDown = 40; shoot(hero.Center); } else { coolDown--; } } for (int i = 0; i < list.Count; i++) { shot temp = list[i]; if (list[i].shotLife == 0) { list[i].bullet.RemoveFromAutoDrawSet(); list[i].emitter.RemoveFromAutoDrawSet(); list.Remove(list[i]); } else { temp.shotLife--; if (hero.Collided(temp.bullet) && !temp.hit) { hero.Caught(); hero.Center = hero.HeroInitialPos; temp.hit = true; heroHit = true; } list[i] = temp; list[i].emitter.Center = list[i].bullet.Center; } } for (int i = 0; i < w.list.Count; i++) { if (w.list[i].bullet.Collided(this)) { if (!shielded) { healthRemaining--; } else { Random r = new Random(); if (r.Next(0, 100) < 10) { healthRemaining--; } } } } if (healthRemaining <= 0) { current = wizardStatus.isDead; Texture = "Newteddybear"; XNACS1Base.PlayACue("Bear-Sound"); return(true); } if (this.Center.X - hero.Center.X > 0) { Texture = shielded ? "wizardShieldLeft" : "wizardLeft"; } else { Texture = shielded ? "wizardShield" : "wizardRight"; } } if (current == wizardStatus.isDead) { for (int i = 0; i < list.Count; i++) { list[i].bullet.RemoveFromAutoDrawSet(); list[i].emitter.RemoveFromAutoDrawSet(); list.Remove(list[i]); } } return(false); }
public void Shoot(XNACS1Rectangle hero) { Vector2 velDir; XNACS1Base.PlayACue("spell"); switch (level) { case 0: shot s = new shot(hero.Center, false); s.bullet.ShouldTravel = true; s.bullet.VelocityDirection = (XNACS1Base.GamePad.ThumbSticks.Right.X == 0 && XNACS1Base.GamePad.ThumbSticks.Right.Y == 0) ? new Vector2(hero.Texture == "newPrincessRight" ? 1 : -1, 0) : XNACS1Base.GamePad.ThumbSticks.Right; list.Add(s); break; case 1: shot s2 = new shot(hero.Center, false); shot s3 = new shot(hero.Center, false); velDir = (XNACS1Base.GamePad.ThumbSticks.Right.X == 0 && XNACS1Base.GamePad.ThumbSticks.Right.Y == 0) ? new Vector2(hero.Texture == "newPrincessRight" ? 1 : -1, 0) : XNACS1Base.GamePad.ThumbSticks.Right; if (velDir.X < 0f && velDir.Y < 0f) { s2.bullet.VelocityDirection = new Vector2(velDir.X + .1f, velDir.Y - .1f); s3.bullet.VelocityDirection = new Vector2(velDir.X - .1f, velDir.Y + .1f); } else if (velDir.Y < 0f && velDir.X > 0f) { s2.bullet.VelocityDirection = new Vector2(velDir.X, velDir.Y - .1f); s3.bullet.VelocityDirection = new Vector2(velDir.X, velDir.Y + .1f); } else if (velDir.Y > 0f && velDir.X < 0f) { s2.bullet.VelocityDirection = new Vector2(velDir.X - .1f, velDir.Y); s3.bullet.VelocityDirection = new Vector2(velDir.X + .1f, velDir.Y); } else { s2.bullet.VelocityDirection = new Vector2(velDir.X + .1f, velDir.Y - .1f); s3.bullet.VelocityDirection = new Vector2(velDir.X - .1f, velDir.Y + .1f); } s2.bullet.ShouldTravel = true; s3.bullet.ShouldTravel = true; list.Add(s2); list.Add(s3); break; case 2: shot s4 = new shot(hero.Center, false); shot s5 = new shot(hero.Center, false); shot s6 = new shot(hero.Center, false); s4.bullet.ShouldTravel = true; s5.bullet.ShouldTravel = true; s6.bullet.ShouldTravel = true; velDir = (XNACS1Base.GamePad.ThumbSticks.Right.X == 0 && XNACS1Base.GamePad.ThumbSticks.Right.Y == 0) ? new Vector2(hero.Texture == "newPrincessRight" ? 1 : -1, 0) : XNACS1Base.GamePad.ThumbSticks.Right; if (velDir.X < 0f && velDir.Y < 0f) { s4.bullet.VelocityDirection = new Vector2(velDir.X, velDir.Y); s5.bullet.VelocityDirection = new Vector2(velDir.X + .1f, velDir.Y - .1f); s6.bullet.VelocityDirection = new Vector2(velDir.X - .1f, velDir.Y + .1f); } else if (velDir.Y < 0f && velDir.X > 0f) { s4.bullet.VelocityDirection = new Vector2(velDir.X, velDir.Y); s5.bullet.VelocityDirection = new Vector2(velDir.X, velDir.Y - .1f); s6.bullet.VelocityDirection = new Vector2(velDir.X, velDir.Y + .1f); } else if (velDir.Y > 0f && velDir.X < 0f) { s4.bullet.VelocityDirection = new Vector2(velDir.X, velDir.Y); s5.bullet.VelocityDirection = new Vector2(velDir.X - .1f, velDir.Y); s6.bullet.VelocityDirection = new Vector2(velDir.X + .1f, velDir.Y); } else { s4.bullet.VelocityDirection = new Vector2(velDir.X, velDir.Y); s5.bullet.VelocityDirection = new Vector2(velDir.X + .1f, velDir.Y - .1f); s6.bullet.VelocityDirection = new Vector2(velDir.X - .1f, velDir.Y + .1f); } list.Add(s4); list.Add(s5); list.Add(s6); break; default: shot s7 = new shot(hero.Center, false); shot s8 = new shot(hero.Center, false); shot s9 = new shot(hero.Center, false); shot s10 = new shot(hero.Center, false); s7.bullet.ShouldTravel = true; s8.bullet.ShouldTravel = true; s9.bullet.ShouldTravel = true; s10.bullet.ShouldTravel = true; velDir = (XNACS1Base.GamePad.ThumbSticks.Right.X == 0 && XNACS1Base.GamePad.ThumbSticks.Right.Y == 0) ? new Vector2(hero.Texture == "newPrincessRight" ? 1 : -1, 0) : XNACS1Base.GamePad.ThumbSticks.Right; if (velDir.X < 0f && velDir.Y < 0f) { s7.bullet.VelocityDirection = new Vector2(velDir.X, velDir.Y); s8.bullet.VelocityDirection = new Vector2(velDir.X + .1f, velDir.Y - .1f); s9.bullet.VelocityDirection = new Vector2(velDir.X - .1f, velDir.Y + .1f); s10.bullet.VelocityDirection = new Vector2(velDir.X * -1f, velDir.Y * -1f); } else if (velDir.Y < 0f && velDir.X > 0f) { s7.bullet.VelocityDirection = new Vector2(velDir.X, velDir.Y); s8.bullet.VelocityDirection = new Vector2(velDir.X, velDir.Y - .1f); s9.bullet.VelocityDirection = new Vector2(velDir.X, velDir.Y + .1f); s10.bullet.VelocityDirection = new Vector2(velDir.X * -1f, velDir.Y * -1f); } else if (velDir.Y > 0f && velDir.X < 0f) { s7.bullet.VelocityDirection = new Vector2(velDir.X, velDir.Y); s8.bullet.VelocityDirection = new Vector2(velDir.X - .1f, velDir.Y); s9.bullet.VelocityDirection = new Vector2(velDir.X + .1f, velDir.Y); s10.bullet.VelocityDirection = new Vector2(velDir.X * -1f, velDir.Y * -1f); } else { s7.bullet.VelocityDirection = new Vector2(velDir.X, velDir.Y); s8.bullet.VelocityDirection = new Vector2(velDir.X + .1f, velDir.Y - .1f); s9.bullet.VelocityDirection = new Vector2(velDir.X - .1f, velDir.Y + .1f); s10.bullet.VelocityDirection = new Vector2(velDir.X * -1f, velDir.Y * -1f); } list.Add(s7); list.Add(s8); list.Add(s9); list.Add(s10); break; } }
public void Update(Cursor oCursor, Camera oCamera, Stats oStats, Hex[,] oHexes, Robber oRobber) { Random oRandom = new Random(); oKeyState = Keyboard.GetState(); //XNACS1Base.EchoToTopStatus("HUD:" + oPickedUpCard); #region Year of Plenty Menu (test) (F3) if (oYearOfPlentymenu == null && oKeyState.IsKeyDown(Keys.F3)) { oYearOfPlentymenu = new YearOfPlentyMenu(); RedrawCards(oStats, oCamera); } if (oYearOfPlentymenu != null) { oYearOfPlentymenu.Update(oCursor, oCamera, this, oStats.oPlayers[0]); if (oYearOfPlentymenu.bFinished == true) { oYearOfPlentymenu.Clear(); oYearOfPlentymenu = null; } } #endregion #region Monopoly Menu (test) (F4) if (oMonopolyMenu == null && oKeyState.IsKeyDown(Keys.F4)) { oMonopolyMenu = new MonopolyMenu(); RedrawCards(oStats, oCamera); } if (oMonopolyMenu != null) { oMonopolyMenu.Update(oCursor, oCamera, this, oStats.oPlayers); if (oMonopolyMenu.bFinished == true) { oMonopolyMenu.Clear(); oMonopolyMenu = null; } } #endregion #region Road Building Menu (test) (F5) if (oRoadBuildingMenu == null && oKeyState.IsKeyDown(Keys.F5)) { oRoadBuildingMenu = new RoadBuildingMenu(); RedrawCards(oStats, oCamera); } if (oRoadBuildingMenu != null) { oRoadBuildingMenu.Update(oCursor, oCamera, this, oStats.oPlayers); if (oRoadBuildingMenu.bFinished == true) { oRoadBuildingMenu.Clear(); oRoadBuildingMenu = null; } } #endregion #region Knight Menu (test) (F6) if (oKnightMenu == null && oKeyState.IsKeyDown(Keys.F6)) { oKnightMenu = new KnightMenu(); RedrawCards(oStats, oCamera); } if (oKnightMenu != null) { oKnightMenu.Update(oCursor, oCamera, this, oStats.oPlayers, oRobber); if (oKnightMenu.bFinished == true) { oKnightMenu.Clear(); oKnightMenu = null; } } #endregion #region Statistics Menues (F7-F9) // button press if (MenuState == eMenuState.NONE) { if (oKeyState.IsKeyDown(Keys.F7)) { MenuState = eMenuState.TURN_RECORDS; } else if (oKeyState.IsKeyDown(Keys.F8)) { MenuState = eMenuState.RESOURCE_GRAPHS; } else if (oKeyState.IsKeyDown(Keys.F9)) { MenuState = eMenuState.TABLE; } } // update if (oStatisticsMenu1 != null) { eMenuState oCurrent = oStatisticsMenu1.Update(oCamera, oCursor); if (oCurrent != eMenuState.NO_CHANGE) { oStatisticsMenu1.Clear(); oStatisticsMenu1 = null; MenuState = oCurrent; } } else if (oStatisticsMenu2 != null) { eMenuState oCurrent = oStatisticsMenu2.Update(oCamera, oCursor); if (oCurrent != eMenuState.NO_CHANGE) { oStatisticsMenu2.Clear(); oStatisticsMenu2 = null; MenuState = oCurrent; } } else if (oStatisticsMenu3 != null) { eMenuState oCurrent = oStatisticsMenu3.Update(oCamera, oCursor); if (oCurrent != eMenuState.NO_CHANGE) { oStatisticsMenu3.Clear(); oStatisticsMenu3 = null; MenuState = oCurrent; } } // create if (MenuState == eMenuState.TURN_RECORDS && oStatisticsMenu1 == null) { oStatisticsMenu1 = new StatisticsMenu1(oStats, oCamera); } else if (MenuState == eMenuState.RESOURCE_GRAPHS && oStatisticsMenu2 == null) { oStatisticsMenu2 = new StatisticsMenu2(oStats, oCamera); } else if (MenuState == eMenuState.TABLE && oStatisticsMenu3 == null) { oStatisticsMenu3 = new StatisticsMenu3(oStats, oCamera); } #endregion #region HUD Follow Camera // hud this.Center = oCamera.oCenter + oHUDDisplacement; // cards for (int x = 0; x < oCards.Count(); x++) { for (int y = 0; y < oCards[x].Count(); y++) { oCards[x][y].Center = oCardDisplacements[x][y] + oCamera.oCenter; } } // buttons for (int x = 0; x < oButtons.Count(); x++) { oButtons[x].Center = oButtonDisplacement[x] + oCamera.oCenter; } #endregion #region Update Small HUDs for (int x = 0; x < oSmallHUDs.Count(); x++) { oSmallHUDs[x].Update(oCamera, oCursor, oStats, this); oSmallHUDs[x].nScores[0] = oStats.oPlayers[x + 1].nVictoryPoints; oSmallHUDs[x].nScores[1] = oStats.oPlayers[x + 1].nArmyCount; oSmallHUDs[x].nScores[2] = oStats.oPlayers[x + 1].nLongestRoad; oSmallHUDs[x].nScores[3] = oStats.oPlayers[x + 1].nDevelopmentCardCount; oSmallHUDs[x].nScores[4] = oStats.oPlayers[x + 1].nResourceCardCount; } #endregion #region Road Button (Left Click), Cancel Building (Right Click) if (oCursor.LeftClick() == true && oButtons[0].Collided(oCursor.oHitbox)) { XNACS1Base.PlayACue("ButtonClick"); if (oStats.oPlayers[oStats.nCurrentPlayer].CanBuildRoad() || oStats.oPlayers[oStats.nCurrentPlayer].nFreeRoads > 0) { oStats.oPlayers[oStats.nCurrentPlayer].eCurrentlyBuilding = Player.CurrentlyBuilding.ROAD; ChangeSelectedButton(oStats); } } else if (oCursor.RightClick()) { oStats.oPlayers[oStats.nCurrentPlayer].eCurrentlyBuilding = Player.CurrentlyBuilding.NONE; ChangeSelectedButton(oStats); } #endregion #region Settlement Button Click if (oCursor.LeftClick() == true && oButtons[1].Collided(oCursor.oHitbox)) { XNACS1Base.PlayACue("ButtonClick"); if (oStats.oPlayers[oStats.nCurrentPlayer].CanBuildSettlement()) { oStats.oPlayers[oStats.nCurrentPlayer].eCurrentlyBuilding = Player.CurrentlyBuilding.SETTLEMENT; ChangeSelectedButton(oStats); } } #endregion #region City Button Click if (oCursor.LeftClick() == true && oButtons[2].Collided(oCursor.oHitbox)) { XNACS1Base.PlayACue("ButtonClick"); if (oStats.oPlayers[oStats.nCurrentPlayer].CanBuildCity()) { oStats.oPlayers[oStats.nCurrentPlayer].eCurrentlyBuilding = Player.CurrentlyBuilding.CITY; ChangeSelectedButton(oStats); } } #endregion #region Development Card Button Click if (oCursor.LeftClick() == true && oButtons[3].Collided(oCursor.oHitbox)) { XNACS1Base.PlayACue("ButtonClick"); if (oStats.oPlayers[oStats.nCurrentPlayer].CanGetDevelopment(oStats.nResourceCardsLeft)) { oStats.oPlayers[oStats.nCurrentPlayer].GetDevelopment(oStats.nResourceCardsLeft, this); oStats.oPlayers[oStats.nCurrentPlayer].eCurrentlyBuilding = Player.CurrentlyBuilding.NONE; ChangeSelectedButton(oStats); ShowCards(oStats.oPlayers[oStats.nCurrentPlayer].nCards, oCamera); } } #endregion #region Dice Button Click if (oCursor.LeftClick() == true && oButtons[4].Collided(oCursor.oHitbox) && bRollMade == false) { XNACS1Base.PlayACue("ButtonClick"); oButtons[4].TextureTintColor = oUnselectedColor; //bRollMade = true; int nRoll1 = oRandom.Next() % 6 + 1; int nRoll2 = oRandom.Next() % 6 + 1; nCurrentRoll = nRoll1 + nRoll2; oDice[0].SetTextureSpriteAnimationFrames(nRoll1, 0, nRoll1, 0, 1, SpriteSheetAnimationMode.AnimateForward); oDice[1].SetTextureSpriteAnimationFrames(nRoll2, 1, nRoll2, 1, 1, SpriteSheetAnimationMode.AnimateForward); oStats.AddRollRecord(nCurrentRoll - 2); if (nCurrentRoll == 7 && bRobberEnabled == true) { oRobber.ShowMessage(); oRobber.bMoveRobber = true; oStats.oPlayers[0].UpdateCardCount(); if (oStats.oPlayers[0].nResourceCardCount > 7) { oRobberMenu = new RobberMenu(oStats.oPlayers[0].nResourceCardCount); RedrawCards(oStats, oCamera); } } int[] nResourceRecord = new int[22]; nResourceRecord[20] = nCurrentRoll; nResourceRecord[21] = oStats.nCurrentTurn; for (int x = 0; x < 5; x++) // give resources to players { for (int y = 0; y < 5; y++) { if (oHexes[x, y] != null) { oHexes[x, y].GiveResources(nCurrentRoll, oStats, nResourceRecord); } } } oStats.AddTurnRecord(nResourceRecord); ShowCards(oStats.oPlayers[0].nCards, oCamera); } #endregion #region Trade Button Click if (oCursor.LeftClick() == true && oButtons[5].Collided(oCursor.oHitbox)) { XNACS1Base.PlayACue("ButtonClick"); oTradeMenu = new TradeMenu(); RedrawCards(oStats, oCamera); } #endregion #region End Turn Button Click if (CanEndTurn(oRobber)) { oButtons[6].TextureTintColor = oOriginalColor; if (oCursor.LeftClick() == true && oButtons[6].Collided(oCursor.oHitbox) && bRollMade == true) { XNACS1Base.PlayACue("ButtonClick"); oButtons[4].TextureTintColor = oOriginalColor; bRollMade = false; oStats.PassTurn(); oTurnNumber.Label = "" + oStats.nCurrentTurn; oCurrentPlayer.Label = "" + oStats.oPlayers[oStats.nCurrentPlayer].sName; } } else { oButtons[6].TextureTintColor = oUnselectedColor; } #endregion #region Trade Menu if (oTradeMenu != null) { oTradeMenu.Update(oCamera, oCursor, this, oStats); if (oTradeMenu.bFinished == true) { oTradeMenu.Clear(); oTradeMenu = null; } } #endregion #region Robber Menu if (oRobberMenu != null) { oRobberMenu.Update(oCamera, oCursor, this); if (oRobberMenu.bFinished == true) { oRobberMenu.Clear(); oRobberMenu = null; } } #endregion #region Pick Up Card/Card Follow Cursor // move picked up card if (oPickedUpCard != null) { oPickedUpCard.Center = oCursor.oHitbox.Center; if (oCursor.IsLeftMouseDown() == false) { if (oTradeMenu != null && oCursor.oHitbox.Collided(oTradeMenu) || oRobberMenu != null && oCursor.oHitbox.Collided(oRobberMenu)) { oStats.oPlayers[0].nCards[nPickedUpCard]--; } oPickedUpCard = null; nPickedUpCard = -1; ShowCards(oStats.oPlayers[0].nCards, oCamera); } } // pick up the card if (oCursor.LeftClick() == true && oPickedUpCard == null) { for (int x = 0; x < oCards.Count(); x++) { if (oCards[x].Count > 0 && oCursor.oHitbox.Collided(oCards[x][oCards[x].Count - 1]) == true) { oPickedUpCard = oCards[x][oCards[x].Count - 1]; nPickedUpCard = x; if (oPickedUpCard.Visible == false) { oPickedUpCard.Visible = true; oCards[x][0].Label = "" + (oCards[x].Count - 1); } } } } #endregion for (int x = 0; x < oDice.Count(); x++) { oDice[x].Center = oCamera.oCenter + oDiceDisplacement[x]; } oTurnNumber.Center = oCamera.oCenter + oTurnNumberDisplacement; oCurrentPlayer.Center = oCamera.oCenter + oCurrentPlayerDisplacement; }
/** * Will play the sound the ball should make when it is ignited */ public void playBallIgnitedSound() { XNACS1Base.PlayACue(defaultFireBounceSound); }
/** * Will play the sound the ball should make when it hits a Joker */ public void playBallJokerSound() { XNACS1Base.PlayACue(defaultJokerBounceSound); }
/** * Will play the sound the ball should make when it shatters something */ public void playBallShatterSound() { XNACS1Base.PlayACue(defaultBreakIceBounceSound); }
/** * Will play the sound the ball should make when it freezes a block */ public void playBallFreezeBlockSound() { XNACS1Base.PlayACue(defaultFreezeBounceSound); }
/** * Will play the sound the ball should make when it bounces of of a wall */ public void playWallBounceSound() { XNACS1Base.PlayACue(defaultWallBounceSound); }
public void playDieSound() { XNACS1Base.PlayACue(defaultDieSound); }
public void playBounceSound() { XNACS1Base.PlayACue(defaultBlockBounceSound); }