Jetpack documentation 1.0.0
Loading...
Searching...
No Matches
Player.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2025
3** jetpack
4** File description:
5** The Player.hpp
6*/
13#ifndef PLAYER_HPP_
14 #define PLAYER_HPP_
15
16 #include "client/Animation.hpp"
17
18namespace Jetpack {
23 class Player
24 {
25 public:
26 /* Constructor and destructor */
27
33 Player(std::size_t id, sf::Vector2u textureSize);
37 ~Player();
42 Player(const Player &) = delete;
48 Player &operator=(const Player &) = delete;
49
50
51
52 /* The state of the player */
53 enum class PlayerState {
54 NORMAL,
55 JETPACK,
56 ZAPPED,
57 FIRED
58 };
59
60
61
62 /* Getter and Setter for player information */
63
68 const std::size_t &getId() const;
73 const std::string &getPseudo() const;
78 void setPseudo(const std::string &pseudo);
83 const bool &isAlive() const;
88 void setAlive(bool alive);
93 const bool &isVisible() const;
98 void setVisible(bool visible);
103 const std::size_t &getScore() const;
108 void setScore(std::size_t score);
113 const std::array<float, 2> &getPosition() const;
118 void setPosition(const std::array<float, 2> &position);
128 const PlayerState &getPlayerState() const;
134 void setPlayerState(PlayerState playerState);
135
136
137
138 private:
139 std::size_t _id; /* The ID of the player */
140 std::string _pseudo; /* The pseudo of the player */
141 bool _alive = true; /* The alive status of the player */
142 bool _visible = true; /* The visible status of the player */
143 std::size_t _score = 0; /* The score of the player */
144 std::array<float, 2> _position = {0, 0}; /* The position of the player */
145 Animation _animation; /* The animation of the player */
146 PlayerState _player_state = PlayerState::NORMAL; /* The state of the player */
147 };
148}
149
150#endif /* PLAYER_HPP_ */
A class that handles sprite animations.
Definition Animation.hpp:27
A class that represents a player in the game.
Definition Player.hpp:24
~Player()
Destructor for Player class.
Definition Player.cpp:36
const std::size_t & getScore() const
Gets the score of the player.
Definition Player.cpp:108
void setVisible(bool visible)
Sets the visible status of the player.
Definition Player.cpp:99
const bool & isVisible() const
Gets the visible status of the player.
Definition Player.cpp:90
void setPseudo(const std::string &pseudo)
Sets the pseudo of the player.
Definition Player.cpp:63
const std::string & getPseudo() const
Gets the pseudo of the player.
Definition Player.cpp:54
void setAlive(bool alive)
Sets the alive status of the player.
Definition Player.cpp:81
Player & operator=(const Player &)=delete
Deleted assignment operator.
void setPlayerState(PlayerState playerState)
Sets the state of the player.
Definition Player.cpp:162
void setPosition(const std::array< float, 2 > &position)
Sets the position of the player.
Definition Player.cpp:135
Player(std::size_t id, sf::Vector2u textureSize)
Constructor for Player class.
Definition Player.cpp:21
void setScore(std::size_t score)
Sets the score of the player.
Definition Player.cpp:117
Animation & getAnimation()
Gets the animation of the player.
Definition Player.cpp:144
const bool & isAlive() const
Gets the alive status of the player.
Definition Player.cpp:72
const std::size_t & getId() const
Gets the ID of the player.
Definition Player.cpp:45
Player(const Player &)=delete
Deleted copy constructor.
const std::array< float, 2 > & getPosition() const
Gets the position of the player.
Definition Player.cpp:126
const PlayerState & getPlayerState() const
Gets the state of the player.
Definition Player.cpp:153