Class Goose


  • public class Goose
    extends Obstacle
    Represents a goose obstacle on the course.
    • Constructor Summary

      Constructors 
      Constructor Description
      Goose​(int xPosition, int yPosition, com.badlogic.gdx.graphics.Texture texture, Lane lane)
      Creates a goose instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void changeDirection()
      Changes the direction of the Goose to an appropriate, random cardinal direction.
      void Move​(float moveVal, int backgroundOffset)
      Moves the goose.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • direction

        public java.lang.String direction
      • givenLane

        public Lane givenLane
    • Constructor Detail

      • Goose

        public Goose​(int xPosition,
                     int yPosition,
                     com.badlogic.gdx.graphics.Texture texture,
                     Lane lane)

        Creates a goose instance.

        Geese can face North, East, South or West. Width and height switch when changing between North or South and East or West.

        Parameters:
        xPosition - X-position.
        yPosition - Y-position.
        texture - Texture asset for the goose.
        lane - Lane the goose will spawn in.
    • Method Detail

      • changeDirection

        public void changeDirection()
        Changes the direction of the Goose to an appropriate, random cardinal direction.
      • Move

        public void Move​(float moveVal,
                         int backgroundOffset)
        Moves the goose.
        Overrides:
        Move in class Obstacle
        Parameters:
        moveVal - Distance to move Goose by.
        backgroundOffset - Offset from screen to course coordinates.