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>

Player Entity.

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)#
virtual void destroy() override#

Destroys the Entity by setting “active” member to false. The Entity’s Manager will then delete it.

Public Members

int player_number#
std::string player_name#

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;.