java.lang.Object
tech.underoaks.coldcase.state.tileContent.TileContent
tech.underoaks.coldcase.state.tileContent.Player
All Implemented Interfaces:
Cloneable

public class Player extends TileContent
The TileContent representing the Player on the playing field. This Content will be controlled by the PlayerController in most cases.
See Also:
  • Field Details

    • currentTexture

      public static com.badlogic.gdx.graphics.Texture currentTexture
      The texture that the player is currently using. This texture indicates the facing direction
  • Constructor Details

    • Player

      public Player()
      Default Constructor
  • Method Details

    • action

      public boolean action(InteractionChain chain, Interaction interaction) throws GameStateUpdateException
      Description copied from class: TileContent
      Performs the action associated with this TileContent when interacted with.
      Specified by:
      action in class TileContent
      Parameters:
      chain - InteractionChain managing the snapshot.
      interaction - The interaction to trigger.
      Returns:
      True if the action has been taken care of; False otherwise
      Throws:
      GameStateUpdateException - If a GameStateUpdate has failed
    • render

      public void render(com.badlogic.gdx.graphics.g2d.Batch batch, float x, float y)
      Renders the object at the specified coordinates using the SpriteBatch. If a texture is currently set, it draws the object with the texture; otherwise, it invokes the superclass's rendering method.
      Overrides:
      render in class TileContent
      Parameters:
      batch - The SpriteBatch used to draw the texture.
      x - The x-coordinate where the texture should be drawn.
      y - The y-coordinate where the texture should be drawn. The y-coordinate is adjusted by adding 8 units for positioning purposes.
    • update

      public boolean update(InteractionChain chain, com.badlogic.gdx.math.Vector2 tilePosition, Interaction interaction, TileContent handler) throws GameStateUpdateException
      Description copied from class: TileContent
      Updates the state of this TileContent based on interactions.
      Specified by:
      update in class TileContent
      Parameters:
      chain - InteractionChain managing the snapshot.
      tilePosition - The position of the currently selected tile.
      interaction - The interaction that is currently being handled.
      handler - The TileContent that has been handling the interaction so far.
      Returns:
      True if an update has been performed; False otherwise
      Throws:
      GameStateUpdateException - If a GameStateUpdate has failed
    • updateTexture

      public static void updateTexture(Direction lookDirection)
      Updates the texture of an object based on the specified direction the object is facing.
      Parameters:
      lookDirection - The direction that the object is looking toward. Valid values are NORTH, SOUTH, EAST, and WEST. The method sets the texture according to this direction.
    • updateMovement

      public void updateMovement(com.badlogic.gdx.math.Vector2 tilePosition, Direction actionDirection)
      Notifies the PlayerController about performed movements of the Player
      Parameters:
      tilePosition - The new position
      actionDirection - The direction in which the player has moved