public override void Update(Microsoft.Xna.Framework.GameTime gt, Screens.MinigameScreen parentScreen) { if ((frameCount % FRAMES_PER_BEAT) == 0) { mySheet.advance(ControllerButton.A, false); } frameCount++; }
public override void Update(Microsoft.Xna.Framework.GameTime gt, Screens.MinigameScreen parentScreen) { if (frameCount >= 120) isStunned = false; // ACTIVATING TEAMMATES foreach (Tugger teammate in team) { if (canActivate) { if (rando.Next(1, ACTIVATE_CHANCE) == (ACTIVATE_CHANCE-1)) { teammate.activate(); canActivate = false; currentButton = buttons.ElementAt(rando.Next(0, buttons.Count)); } } } /* // TEST OTHER PLAYERS bool canPull = false; Tugger activator = null; foreach (Tugger teammate in team) { if (teammate.isActive) { canPull = true; activator = teammate; } } if (canPull) { for (int x = 0; x < buttons.Count; x++) { if (players[0].GamePad.IsButtonPressed(currentButton)) { bigTug(activator); canActivate = true; } } } */ // OTHER PLAYERS if (!isStunned) { for (int x = 1; x < players.Length; x++) { for (int y = 0; y < buttons.Count; y++) { if (players[x].GamePad.IsButtonPressed(buttons.ElementAt(y))) { if (buttons.ElementAt(y).Equals(currentButton)) { if (team.ElementAt(x - 1).isActive) { bigTug(team.ElementAt(x - 1)); } else { isStunned = true; frameCount = 0; } } else { isStunned = true; frameCount = 0; } } } } } // PLAYER ONE if (players[0].GamePad.IsButtonPressed(ControllerButton.A)) { ropePosition.Offset(P1_STRENGTH, 0); foreach (Tugger teammate in team) { teammate.move(P1_STRENGTH); } p1.move(P1_STRENGTH); } frameCount++; }
public override void Update(Microsoft.Xna.Framework.GameTime gt, Screens.MinigameScreen parentScreen) { // Start paused and then begin foreach (Pipe pipe in pipes) { if (pipe.fc() == 120) { pipe.setSpeed(2); } } foreach (Pipe pipe in pipes) { pipe.moveLightBox(); } // FIRING AND HITTING foreach (Pipe pipe in pipes) { if (pipe.getPlayer().GamePad.IsButtonPressed(pipe.getButton())) { if (pipe.canDown()) { pipe.moveHit(true, lightHitSprite.getTexture().Height); pipe.checkForHit(); pipe.canDown(false); } } // DUBUG ONLY if (Keyboard.GetState().IsKeyDown(Keys.Space)) { if (pipe.canDown()) { pipe.moveHit(true, lightHitSprite.getTexture().Height); pipe.checkForHit(); pipe.canDown(false); } } if (players.Where(x => x.isP1).First().GamePad.IsButtonPressed(pipe.getButton())) { if (pipe.canUp()) { pipe.moveHit(false, -(lightHitSprite.getTexture().Height)); pipe.checkForHit(); pipe.canUp(false); } } } // RETRACTING foreach (Pipe pipe in pipes) { if (pipe.isFired(true)) { pipe.moveHit(true, -RETRACT_SPEED); } else { pipe.canDown(true); } if (pipe.isFired(false)) { pipe.moveHit(false, RETRACT_SPEED); } else { pipe.canUp(true); } } // SCORING foreach (Pipe pipe in pipes) { if (pipe.getlightBox().Intersects(pipe.getUpEndBox())) { scores[0]++; pipe.reset(); } if (pipe.getlightBox().Intersects(pipe.getDownEndBox())) { for (int x = 0; x < players.Length; x++) { if (players[x].Equals(pipe.getPlayer())) { scores[x]++; } } pipe.reset(); } } // INCREMENT FRAME COUNTS foreach (Pipe pipe in pipes) { pipe.incrementFC(); } }
public override void Update(Microsoft.Xna.Framework.GameTime gt, Screens.MinigameScreen parentScreen) { if (frameCount == 120) { lightSpeed = 2; } // PLAYER ONE if (lightHitBox1.Y < lightHit1Pos) { lightHitBox1.Offset(0, 1); } else if (!players[0].GamePad.IsButtonPressed(ControllerButton.A)) { canHitUp = true; } if (players[0].GamePad.IsButtonPressed(ControllerButton.A)) { if (canHitUp) { lightHitBox1.Offset(0, -(lightHitSprite.getTexture().Height + 1)); } canHitUp = false; } if (lightHitBox1.Intersects(lightBox)) { lightGoingDown = false; if (lightBox.Bottom >= pipeEndBox1.Top - 10) { lightSpeed = 6; } else { lightSpeed = 2; } } // OTHER PLALYERS if (lightHitBox2.Y > lightHit2Pos) { lightHitBox2.Offset(0, -1); } else { canHitDown = true; } if (/*players[1].GamePad.IsButtonPressed(ControllerButton.A)*/ Keyboard.GetState().IsKeyDown(Keys.Space)) { if (canHitDown) { lightHitBox2.Offset(0, (lightHitSprite.getTexture().Height + 1)); } canHitDown = false; } if (lightHitBox2.Intersects(lightBox)) { lightGoingDown = true; if (lightBox.Top <= pipeEndBox2.Bottom + 10) { lightSpeed = 6; } else { lightSpeed = 2; } } //LIGHT if (lightGoingDown) { lightBox.Offset(0, lightSpeed); } else { lightBox.Offset(0, -lightSpeed); } if (lightBox.Intersects(pipeEndBox1)) { p2score++; lightBox.Offset(0, -(pipeSprite.getTexture().Height / 2)); } if (lightBox.Intersects(pipeEndBox2)) { p1score++; lightBox.Offset(0, (pipeSprite.getTexture().Height - (int)PIPE_POS_Y) / 2); } frameCount++; }