Class Player

class Player

THe Player class represents the player character that the player controls.

Public Functions

Player(std::unique_ptr<Actor> actor, Room &room)

Construct from an Actor and the Room where the Player shall be contained.

void unload() const

Unload routine.

void update()

Update routine.

void draw() const

Draw routine.

void setRoom(Room &room) const

Set the Player’s current room.

Actor &getActor() const

Get the player’s actor

void moveByVelocity(Vector2 velocity)

Move the player by a certain velocity.

Vector2 getPosition() const

Get the player’s position.

void setPosition(Vector2 pos)

Set the player’s position.

Vector2 getCenterPosition() const

Get the player’s position with an ‘anchor’ in the center.

Vector2 getTilePosition() const

Get the player’s tile position.

void setTilePosition(Vector2 tilePos)

Set the player’s tile position.

Vector2 getCollisionPos() const

Get the position of the collision.

Vector2 getCollisionCenterPos() const

Get the center position of the player’s collision.

void setMovementLock(bool value)

Set whether the Player should be able to move or not.