public void Update() { if (frame >= 20) { stateMachine.RemoveProjectile(this); } if (frame < 10) { if (projectileDirection == Direction.MoveUp) { yLoc -= candleSpeed; } else if (projectileDirection == Direction.MoveDown) { yLoc += candleSpeed; } else if (projectileDirection == Direction.MoveLeft) { xLoc -= candleSpeed; } else //MoveRight { xLoc += candleSpeed; } } destinationRectangle = new Rectangle(xLoc, yLoc, candleSize, candleSize); flip = !flip; frame++; }
public void Update() { if (frame >= 12) { stateMachine.RemoveProjectile(this); } if (frame < 10) { if (projectileDirection == Direction.MoveUp) { yLoc -= ArrowSpeed; } else if (projectileDirection == Direction.MoveDown) { yLoc += ArrowSpeed; } else if (projectileDirection == Direction.MoveLeft) { xLoc -= ArrowSpeed; } else //MoveRight { xLoc += ArrowSpeed; } destinationRectangle = new Rectangle(xLoc, yLoc, xSize, ySize); } else { sourceRectangle = new Rectangle(53, 185, 8, 15); if (projectileDirection == Direction.MoveLeft || projectileDirection == Direction.MoveRight) { if (frame == 10) { yLoc -= ySize / 2; if (projectileDirection == Direction.MoveLeft) { xLoc -= xSize / 2; } else { xLoc += xSize / 2; } } destinationRectangle = new Rectangle(xLoc, yLoc, ySize, xSize); } else { destinationRectangle = new Rectangle(xLoc, yLoc, xSize, ySize); } } frame++; }
public void Update() { if (frame >= 22) { stateMachine.RemoveProjectile(this); } if (frame == 20) { xLoc -= bombSizeX / 2; destinationRectangle = new Rectangle(xLoc, yLoc, bombSizeY, bombSizeY); } if (frame >= 20) { sourceRectangle = new Rectangle(138 + (frame - 20) * 17, 185, 15, 15); } frame++; }
public void Update() { if (boomerangSpeed > 0 && !goBack) { if (projectileDirection == Direction.MoveUp) { yLoc -= boomerangSpeed; } else if (projectileDirection == Direction.MoveDown) { yLoc += boomerangSpeed; } else if (projectileDirection == Direction.MoveLeft) { xLoc -= boomerangSpeed; } else //MoveRight { xLoc += boomerangSpeed; } boomerangSpeed -= 1; } else { goBack = true; boomerangSpeed += 1; if (xLoc - stateMachine.getXLoc() >= boomerangSpeed) { xLoc -= boomerangSpeed; } else if (xLoc - stateMachine.getXLoc() <= boomerangSpeed * -1) { xLoc += boomerangSpeed; } if (yLoc - stateMachine.getYLoc() >= boomerangSpeed) { yLoc -= boomerangSpeed; } else if (yLoc - stateMachine.getYLoc() <= boomerangSpeed * -1) { yLoc += boomerangSpeed; } if (Math.Abs(xLoc - stateMachine.getXLoc()) <= boomerangSpeed && Math.Abs(yLoc - stateMachine.getYLoc()) <= boomerangSpeed) { stateMachine.RemoveProjectile(this); } } destinationRectangle = new Rectangle(xLoc, yLoc, xSize, ySize); if (frame % 4 == 0) { sourceRectangle = new Rectangle(64, 185, 8, 15); } else if (frame % 4 == 1 || frame % 4 == 3) { sourceRectangle = new Rectangle(73, 185, 8, 15); } else if (frame % 4 == 2) { sourceRectangle = new Rectangle(82, 185, 8, 15); } if (frame % 8 == 0 || frame % 8 == 1 || frame % 8 == 2) { flip = SpriteEffects.None; } else if (frame % 8 == 3 || frame % 8 == 4) { flip = SpriteEffects.FlipHorizontally; } else if (frame % 8 == 5) { flip = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically; } else if (frame % 8 == 6 || frame % 8 == 7) { flip = SpriteEffects.FlipVertically; } frame++; }