Jetpack documentation 1.0.0
Loading...
Searching...
No Matches
Player Class Reference

A class that represents a player in the game. More...

#include <Player.hpp>

Public Types

enum class  PlayerState { NORMAL , JETPACK , ZAPPED , FIRED }
 

Public Member Functions

 Player (std::size_t id, sf::Vector2u textureSize)
 Constructor for Player class.
 
 ~Player ()
 Destructor for Player class.
 
 Player (const Player &)=delete
 Deleted copy constructor.
 
Playeroperator= (const Player &)=delete
 Deleted assignment operator.
 
const std::size_t & getId () const
 Gets the ID of the player.
 
const std::string & getPseudo () const
 Gets the pseudo of the player.
 
void setPseudo (const std::string &pseudo)
 Sets the pseudo of the player.
 
const bool & isAlive () const
 Gets the alive status of the player.
 
void setAlive (bool alive)
 Sets the alive status of the player.
 
const bool & isVisible () const
 Gets the visible status of the player.
 
void setVisible (bool visible)
 Sets the visible status of the player.
 
const std::size_t & getScore () const
 Gets the score of the player.
 
void setScore (std::size_t score)
 Sets the score of the player.
 
const std::array< float, 2 > & getPosition () const
 Gets the position of the player.
 
void setPosition (const std::array< float, 2 > &position)
 Sets the position of the player.
 
AnimationgetAnimation ()
 Gets the animation of the player.
 
const PlayerState & getPlayerState () const
 Gets the state of the player.
 
void setPlayerState (PlayerState playerState)
 Sets the state of the player.
 

Private Attributes

std::size_t _id
 
std::string _pseudo
 
bool _alive = true
 
bool _visible = true
 
std::size_t _score = 0
 
std::array< float, 2 > _position = {0, 0}
 
Animation _animation
 
PlayerState _player_state = PlayerState::NORMAL
 

Detailed Description

A class that represents a player in the game.

Constructor & Destructor Documentation

◆ Player() [1/2]

Player ( std::size_t id,
sf::Vector2u textureSize )

Constructor for Player class.

Parameters
idThe ID of the player
textureSizeThe size of the texture

◆ Player() [2/2]

Player ( const Player & )
delete

Deleted copy constructor.

Parameters
otherThe Player object to copy from

Member Function Documentation

◆ getAnimation()

Animation & getAnimation ( )

Gets the animation of the player.

Returns
The animation of the player

◆ getId()

const std::size_t & getId ( ) const

Gets the ID of the player.

Returns
The ID of the player

◆ getPlayerState()

const Player::PlayerState & getPlayerState ( ) const

Gets the state of the player.

Returns
The state of the player

◆ getPosition()

const std::array< float, 2 > & getPosition ( ) const

Gets the position of the player.

Returns
The position of the player

◆ getPseudo()

const std::string & getPseudo ( ) const

Gets the pseudo of the player.

Returns
The pseudo of the player

◆ getScore()

const std::size_t & getScore ( ) const

Gets the score of the player.

Returns
The score of the player

◆ isAlive()

const bool & isAlive ( ) const

Gets the alive status of the player.

Returns
The alive status of the player

◆ isVisible()

const bool & isVisible ( ) const

Gets the visible status of the player.

Returns
The visible status of the player

◆ operator=()

Player & operator= ( const Player & )
delete

Deleted assignment operator.

Parameters
otherThe Player object to assign from
Returns
Reference to the current object

◆ setAlive()

void setAlive ( bool alive)

Sets the alive status of the player.

Parameters
aliveThe alive status of the player

◆ setPlayerState()

void setPlayerState ( PlayerState playerState)

Sets the state of the player.

Note
This function changes the animation of the player
Parameters
playerStateThe state of the player
playerStateThe state of the player

◆ setPosition()

void setPosition ( const std::array< float, 2 > & position)

Sets the position of the player.

Parameters
positionThe position of the player

◆ setPseudo()

void setPseudo ( const std::string & pseudo)

Sets the pseudo of the player.

Parameters
pseudoThe pseudo of the player

◆ setScore()

void setScore ( std::size_t score)

Sets the score of the player.

Parameters
scoreThe score of the player

◆ setVisible()

void setVisible ( bool visible)

Sets the visible status of the player.

Parameters
visibleThe visible status of the player

The documentation for this class was generated from the following files: