Class Goose


public class Goose extends SpriteAnimations
Represents and controls a goose
  • Field Details

    • isFacingLeft

      public boolean isFacingLeft
    • hasStolenTorch

      public boolean hasStolenTorch
    • currentGooseFrame

      public com.badlogic.gdx.graphics.g2d.TextureRegion currentGooseFrame
    • isFlying

      public boolean isFlying
    • baby

      public Goose baby
    • attackModeActivated

      public boolean attackModeActivated
    • isSleeping

      public boolean isSleeping
  • Constructor Details

    • Goose

      public Goose()
      Generate goose and its animations
  • Method Details

    • moveGoose

      public void moveGoose(float stateTime, float followX, float followY, boolean isPlayerMoving, boolean followIsSleeping)
      Move goose towards target and update animations
      Parameters:
      stateTime - time in seconds since last frame
      followX - x of target
      followY - y of target
      isPlayerMoving - is player moving
    • getWidth

      public float getWidth()
      get width of goose frame
      Returns:
      width of goose
    • getHeight

      public float getHeight()
      get height of goose frame
      Returns:
      height of goose
    • loadBabyGoose

      public void loadBabyGoose(int gooseIndex)
      Recursively generate a trail of baby geese Each goose points to the next baby goose Base case: Goose index, only generate 5 geese
      Parameters:
      gooseIndex - number of current goose in the trail
    • attackMode

      public void attackMode()
      Goose steals torch
    • nextRunLocation

      public int[] nextRunLocation()
      Path for goose to run with torch
      Returns:
      destination coordinates