Player (entity)#
This class defines a Player Entity.
Typedefs
-
using vec = Eigen::Vector2f
Variables
-
constexpr int max_players = 4#
-
struct Player : public Entity#
- #include <Player.hpp>
Public Functions
-
Player(Manager &man, std::string name, std::string sprite_name, float sprite_scale = 10, float speed = 10)#
Initializes the player instance with a given sprite.
- Parameters:
sprite_name – The projectile’s texture id (stored in Game::assets).
sprite_scale – The scale factor to pass to the Sprite component.
speed – The speed to pass to the Transform component.
-
void destroy(bool create_temp_entity)#
Public Static Attributes
-
static std::array<bool, max_players> allocated_players =
[]{std::array<bool, max_players> arr;std::fill(arr.begin(), arr.end(), false);return arr;}()
#
-
static std::unordered_map<int, SDL_Color> player_colour = {{1, {255, 0, 0, 255}}, {2, {0, 0, 255, 255}}, {3, {0, 200, 0, 255}}, {4, {255, 255, 0, 255}}}#
Colours associated to each player. Initialized in Player.cpp;.
-
Player(Manager &man, std::string name, std::string sprite_name, float sprite_scale = 10, float speed = 10)#