Class Goose


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

      Constructors 
      Constructor Description
      Goose​(java.util.HashMap<java.lang.String,​com.badlogic.gdx.graphics.Texture> textures, int xPosition, int yPosition, Lane[] lanes, int laneNo)
      Creates a goose instance.
    • Field Detail

      • direction

        public java.lang.String direction
      • lanes

        public Lane[] lanes
      • laneNo

        public int laneNo
    • Constructor Detail

      • Goose

        public Goose​(java.util.HashMap<java.lang.String,​com.badlogic.gdx.graphics.Texture> textures,
                     int xPosition,
                     int yPosition,
                     Lane[] lanes,
                     int laneNo)

        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:
        textures - Reference to loaded textures
        xPosition - X-position.
        yPosition - Y-position.
        lanes - Lanes in the map.
        laneNo - Lane number 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.