Peoplemon  0.1.0
Peoplemon 3 game source documentation
Public Member Functions | List of all members
core::system::Entity Class Reference

Basic helper system for creating entities and their required components. Also manages player data and entity id. More...

#include <Entity.hpp>

Public Member Functions

 Entity (Systems &owner)
 Construct a new Entity system. More...
 
bl::ecs::Entity spawnCharacter (const map::CharacterSpawn &spawn, map::Map &map)
 Spawns a trainer or an npc from the given spawn information. More...
 
bool spawnItem (const map::Item &item, map::Map &map)
 Spawns an item into the world. More...
 
bl::ecs::Entity spawnGeneric (std::uint8_t level, const glm::i32vec2 &tiles, bool collidable, const std::string &gfx, map::Map &map)
 Spawns a generic entity with some basic components. More...
 
bl::ecs::Entity spawnAnimation (std::uint8_t level, const glm::vec2 &position, const std::string &gfx, map::Map &map)
 Spawns an animation-only entity at the given position. The animation is not played until manually triggered. More...
 

Detailed Description

Basic helper system for creating entities and their required components. Also manages player data and entity id.

Definition at line 27 of file Entity.hpp.

Constructor & Destructor Documentation

◆ Entity()

core::system::Entity::Entity ( Systems owner)

Construct a new Entity system.

Parameters
ownerThe primary systems object

Definition at line 22 of file Entity.cpp.

Member Function Documentation

◆ spawnAnimation()

bl::ecs::Entity core::system::Entity::spawnAnimation ( std::uint8_t  level,
const glm::vec2 &  position,
const std::string &  gfx,
map::Map map 
)

Spawns an animation-only entity at the given position. The animation is not played until manually triggered.

Parameters
levelThe map level to spawn on
positionThe position to spawn the entity at
gfxThe path to the animation to render
mapThe map to spawn in
Returns
The created entity id or InvalidEntity

Definition at line 155 of file Entity.cpp.

◆ spawnCharacter()

bl::ecs::Entity core::system::Entity::spawnCharacter ( const map::CharacterSpawn spawn,
map::Map map 
)

Spawns a trainer or an npc from the given spawn information.

Parameters
spawnThe map spawn information
mapThe map to spawn in
Returns
Id of the created entity, or InvalidId if spawn failed

NPC

More common components

Definition at line 25 of file Entity.cpp.

◆ spawnGeneric()

bl::ecs::Entity core::system::Entity::spawnGeneric ( std::uint8_t  level,
const glm::i32vec2 &  tiles,
bool  collidable,
const std::string &  gfx,
map::Map map 
)

Spawns a generic entity with some basic components.

Parameters
levelThe map level to spawn on
tilesThe position to spawn at
collidableTrue to add a collidable component, false to not
gfxPath to image or animation for graphic component
mapThe map to spawn in
Returns
The created entity id or InvalidEntity

Definition at line 127 of file Entity.cpp.

◆ spawnItem()

bool core::system::Entity::spawnItem ( const map::Item item,
map::Map map 
)

Spawns an item into the world.

Parameters
itemThe item information to spawn
mapThe map to spawn in
Returns
True if the item was spawned, false on error

Definition at line 98 of file Entity.cpp.


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