Class FinishLine


  • public class FinishLine
    extends Entity
    Represents the finish line of the race.
    • Constructor Summary

      Constructors 
      Constructor Description
      FinishLine​(com.badlogic.gdx.math.Vector2 pos, int width)
      Creates a new Finish Line at a position and with a width which it will span.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void render​(com.badlogic.gdx.graphics.g2d.SpriteBatch batch)
      Render the texture at the position and specified width.
      void update​(float playerPos, float raceDistance, float deltaTime, float velY)
      Update the position of the finish line so that it moves towards the player.
      • Methods inherited from class java.lang.Object

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

      • widthScale

        private final float widthScale
        The scale at which to render at.
    • Constructor Detail

      • FinishLine

        public FinishLine​(com.badlogic.gdx.math.Vector2 pos,
                          int width)
        Creates a new Finish Line at a position and with a width which it will span.
        Parameters:
        pos - The position of the finish line.
        width - The width of the finish line.
    • Method Detail

      • update

        public void update​(float playerPos,
                           float raceDistance,
                           float deltaTime,
                           float velY)
        Update the position of the finish line so that it moves towards the player.
        Parameters:
        playerPos - The distance the player has travelled in the race.
        raceDistance - The total distance of the race.
        deltaTime - The time passed since the last frame.
        velY - The y-velocity of the entity it will move in respect to (Will be the player)
      • render

        public void render​(com.badlogic.gdx.graphics.g2d.SpriteBatch batch)
        Render the texture at the position and specified width.
        Overrides:
        render in class Entity
        Parameters:
        batch - The SpriteBatch to be added to.