public BrownBoomerangProjectile(Texture2D spritesheet, LinkStateMachine stateMachine) { this.spritesheet = spritesheet; this.stateMachine = stateMachine; projectileDirection = stateMachine.getDirection(); if (projectileDirection == Direction.MoveUp) { xLoc = stateMachine.getXLoc() + xSize / 2; yLoc = stateMachine.getYLoc() - ySize; } else if (projectileDirection == Direction.MoveDown) { xLoc = stateMachine.getXLoc() + xSize / 2; yLoc = stateMachine.getYLoc() + ySize; } else if (projectileDirection == Direction.MoveLeft) { xLoc = stateMachine.getXLoc() - xSize; yLoc = stateMachine.getYLoc(); } else //MoveRight { xLoc = stateMachine.getXLoc() + xSize * 2; yLoc = stateMachine.getYLoc(); } goBack = false; flip = SpriteEffects.None; sourceRectangle = new Rectangle(64, 185, 8, 15); destinationRectangle = new Rectangle(xLoc, yLoc, xSize, ySize); frame = 0; }
public BombProjectile(Texture2D spritesheet, LinkStateMachine stateMachine) { this.stateMachine = stateMachine; projectileDirection = stateMachine.getDirection(); if (projectileDirection == Direction.MoveUp) { xLoc = stateMachine.getXLoc() + bombSizeX / 2; yLoc = stateMachine.getYLoc() - bombSizeY; } else if (projectileDirection == Direction.MoveDown) { xLoc = stateMachine.getXLoc() + bombSizeX / 2; yLoc = stateMachine.getYLoc() + bombSizeY; } else if (projectileDirection == Direction.MoveLeft) { xLoc = stateMachine.getXLoc() - bombSizeX; yLoc = stateMachine.getYLoc(); } else //MoveRight { xLoc = stateMachine.getXLoc() + bombSizeX * 2; yLoc = stateMachine.getYLoc(); } sourceRectangle = new Rectangle(129, 185, 8, 15); destinationRectangle = new Rectangle(xLoc, yLoc, bombSizeX, bombSizeY); frame = 0; this.spritesheet = spritesheet; }
public CandleFireProjectile(Texture2D spritesheet, LinkStateMachine stateMachine) { this.stateMachine = stateMachine; projectileDirection = stateMachine.getDirection(); if (projectileDirection == Direction.MoveUp) { xLoc = stateMachine.getXLoc(); yLoc = stateMachine.getYLoc() - candleSize; } else if (projectileDirection == Direction.MoveDown) { xLoc = stateMachine.getXLoc(); yLoc = stateMachine.getYLoc() + candleSize; } else if (projectileDirection == Direction.MoveLeft) { xLoc = stateMachine.getXLoc() - candleSize; yLoc = stateMachine.getYLoc(); } else //MoveRight { xLoc = stateMachine.getXLoc() + candleSize; yLoc = stateMachine.getYLoc(); } flip = false; sourceRectangle = new Rectangle(191, 185, 15, 15); destinationRectangle = new Rectangle(xLoc, yLoc, candleSize, candleSize); frame = 0; this.spritesheet = spritesheet; }
public void Draw(SpriteBatch spriteBatch) { if (stateMachine.getDirection() == Direction.MoveLeft) { spriteBatch.Draw(linkSpriteSheet, destination, source, Color.White, 0, new Vector2(0, 0), SpriteEffects.FlipHorizontally, 0f); } else { spriteBatch.Draw(linkSpriteSheet, destination, source, Color.White); } foreach (IProjectile projectile in stateMachine.getProjectiles()) { projectile.Draw(spriteBatch); } }
public BrownArrowProjectile(Texture2D spritesheet, LinkStateMachine stateMachine) { this.spritesheet = spritesheet; this.stateMachine = stateMachine; projectileDirection = stateMachine.getDirection(); if (projectileDirection == Direction.MoveUp) { xSize = ArrowWidth; ySize = ArrowLength; xLoc = stateMachine.getXLoc() + xSize / 2; yLoc = stateMachine.getYLoc() - ySize; flip = SpriteEffects.None; } else if (projectileDirection == Direction.MoveDown) { xSize = ArrowWidth; ySize = ArrowLength; xLoc = stateMachine.getXLoc() + xSize / 2; yLoc = stateMachine.getYLoc() + ySize; flip = SpriteEffects.FlipVertically; } else if (projectileDirection == Direction.MoveLeft) { xSize = ArrowLength; ySize = ArrowWidth; xLoc = stateMachine.getXLoc() - xSize; yLoc = stateMachine.getYLoc() + ySize / 2; flip = SpriteEffects.FlipHorizontally; } else //MoveRight { xSize = ArrowLength; ySize = ArrowWidth; xLoc = stateMachine.getXLoc() + xSize; yLoc = stateMachine.getYLoc() + ySize / 2; flip = SpriteEffects.None; } if (projectileDirection == Direction.MoveUp || projectileDirection == Direction.MoveDown) { sourceRectangle = new Rectangle(1, 185, 8, 15); } else { sourceRectangle = new Rectangle(10, 188, 15, 8); } destinationRectangle = new Rectangle(xLoc, yLoc, xSize, ySize); frame = 0; }