Class Obstacle

  • Direct Known Subclasses:
    Goose, Log

    public class Obstacle
    extends java.lang.Object
    Represents an obstacle on the course.
    See Also:
    Log, Goose
    • Constructor Summary

      Constructors 
      Constructor Description
      Obstacle​(java.util.HashMap<java.lang.String,​com.badlogic.gdx.graphics.Texture> textures, int damage, int xPosition, int yPosition, java.lang.Integer width, java.lang.Integer height, java.lang.String name)
      Creates an obstacle instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getDamage()  
      int getHeight()  
      java.lang.String getName()  
      com.badlogic.gdx.graphics.Texture getTexture()  
      float getX()  
      float getY()  
      void Move​(float moveVal, int backgroundOffset)
      Moves the obstacle.
      void setX​(float xPosition)  
      void setY​(float yPosition)  
      • Methods inherited from class java.lang.Object

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

      • yPosition

        protected float yPosition
      • xPosition

        protected float xPosition
      • damage

        protected int damage
      • width

        public int width
      • height

        public int height
      • texture

        public com.badlogic.gdx.graphics.Texture texture
    • Constructor Detail

      • Obstacle

        public Obstacle​(java.util.HashMap<java.lang.String,​com.badlogic.gdx.graphics.Texture> textures,
                        int damage,
                        int xPosition,
                        int yPosition,
                        java.lang.Integer width,
                        java.lang.Integer height,
                        java.lang.String name)
        Creates an obstacle instance.
        Parameters:
        textures - Reference to loaded textures
        damage - Damage the obstacle can inflict on a boat.
        xPosition - X-position.
        yPosition - Y-position.
        width - Width of the obstacle.
        height - Height of the obstacle.
        name - Name of the obstacle.
    • Method Detail

      • Move

        public void Move​(float moveVal,
                         int backgroundOffset)
        Moves the obstacle.
        Parameters:
        moveVal - Distance to move the object by.
        backgroundOffset - Offset from screen to course coordinates.
      • getName

        public java.lang.String getName()
        Returns:
        String representing the obstacle's name
      • getDamage

        public int getDamage()
        Returns:
        Int representing damage the obstacle inflicts upon collision.
      • getX

        public float getX()
        Returns:
        Float representing the x-position.
      • getY

        public float getY()
        Returns:
        Float representing the y-position.
      • setY

        public void setY​(float yPosition)
        Parameters:
        yPosition - Y-position.
      • setX

        public void setX​(float xPosition)
        Parameters:
        xPosition - X-position.
      • getTexture

        public com.badlogic.gdx.graphics.Texture getTexture()
        Returns:
        Texture asset for obstacle.
      • getHeight

        public int getHeight()
        Returns:
        Int representing the height of the obstacle.