Class PlayerBoat


  • public class PlayerBoat
    extends Boat
    Represents a specific Player controlled Boat.
    • Constructor Detail

      • PlayerBoat

        public PlayerBoat​(BoatType boat,
                          Lane lane,
                          java.lang.String name)
        Creates a player boat with values from boat, in Lane lane, and an identifying name.
        Parameters:
        boat - The BoatType to get values from.
        lane - The lane the boat is racing in.
        name - The name of the boat.
    • Method Detail

      • update

        public void update​(float deltaTime)
        Update the boats position in respects to the time passed since the last frame.
        Overrides:
        update in class Boat
        Parameters:
        deltaTime - The time passed since the last frame.
      • render

        public void render​(com.badlogic.gdx.graphics.g2d.SpriteBatch batch)
        Renders the players boat with the word "Player" at the top of the lane to indicate which lane is the players.
        Overrides:
        render in class Boat
        Parameters:
        batch - The SpriteBatch that the renders will be added to.
      • updateYPosition

        public void updateYPosition​(int lineHeight,
                                    int raceDistance)
        Update the vertical position of the boat on-screen. Is related to the distance travelled in the race.
        Overrides:
        updateYPosition in class Boat
        Parameters:
        lineHeight - The height of the finish line Entity.
        raceDistance - The length of the race.
      • isDead

        public boolean isDead()
        If the player boat has no health left.
        Returns:
        A boolean of if the boat is dead.