AEntity
The AEntity class is the base of all entitites in the game. The methods in this class are used by all entities to interact with the game and to interact between each other.
This class is derived from the IEntity interface and implements some of its methods.
Some methods remains as pure virtual and must be implemented in each entity.
Public member functions
Protected member functions
Protected attributes
Member functions documentation
Constructor
This constructor creates a new AEntity with the given parameters.
Parameters
room
: The room in which the entity is.id
: The id of the entity.x
: The x position of the entity.y
: The y position of the entity.w
: The width of the entity.h
: The height of the entity.pos
: The position of the entity.size
: The size of the entity.
refresh
See IEntity::refresh.
position
See IEntity::position.
id
See IEntity::id.
isOutOfScreen
See IEntity::isOutOfScreen.
collide
See IEntity::collide.
box
See IEntity::box.
killEntity
See IEntity::killEntity.
getExist
See IEntity::getExist.
getDeletable
See IEntity::getDeletable.
move
This function moves the entity by the given amount of delta x and delta y.
Parameters
dx
: The delta x to move the entity by.dy
: The delta y to move the entity by.
Attributes documentation
_room
The room in which the entity is. It is mainly used to send some messages to all clients connected to the room.
_id
The id of the entity.
_box
The bounding box of the entity (position and size).
_exist
The existence of the entity (alive).
_deletable
The deletability of the entity (dead). This attribute is used by the game loop to delete the entity.
_lastMove
The last time the entity moved. This attribute is used to manage the time between each move of the entity by the refresh
method.