AliveEntity

Classes derived from this one

Type
Monster
LandMonster

Members

Type Member Description
Vec2 pos Position
Vec2 vel Vitesse

Constructors

No constructors. Instances should be created using the centauri api.

Methods

Ret Function Args
instanceDestroy ()
bool tileFree (x, y)
[X] getContext ()
[X] getWorld ()
physicsUpdateGravity (dt, gravity, friction, ground_fric, on_ground)
[X] boundingBoxRelative ()
[X] boundingBox ()
bool alive ()
float lifeCoeff ()
[X] hurtBase (damages, *owner)
bool wall (rect, scalex)
float wallHeight (rect, scalex, max)
multiplayerSmooth
Movement
(buffer)
[X] status ()

Descriptions

instanceDestroy()

Destroy the entity.

bool tileFree

Type ArgName Description
float x Horizontal coordinate
float y Vertical coordinate

Collision detection algorithm using the collision mask of the entity to check if the position is free at (x, y). Basically, it check if there is no block colliding with the entity at the given position.

WorldContext& getContext()

Return the associated WorldContext of the entity.

World& getWorld()

Return the associated World of the entity.

physicsUpdateGravity

Type ArgName Description
float dt Delta time
float gravity Vertical gravity force
Vec2 friction Air friction vector
float ground_fric Horizontal ground friction
bool on_ground Specify if on ground

Apply gravity to the internal force vector vel.

Rect boundingBoxRelative()

Return the relative axis aligned bounding box of the entity.

Rect boundingBox()

Return the axis aligned bounding box of the entity.

bool alive()

Indicate if health of the entity is > 0.

float lifeCoeff()

Life level of the entity from 0.0 (0%) to 1.0 (100%).

Hit hurtBase()

Base class method without any overriding.

bool wall

Type ArgName Description
Rect rect
float scalex

Check if there is any wall on the side.

float wallHeight

Type ArgName Description
Rect rect
float scalex
i32 max

Return the height of the side wall.

multiplayerSmoothMovement

Type ArgName Description
StreamData& buffer Received packet buffer

Read pos and vel from the buffer and do some interpolation to get a smooth movement in multiplayer.

AlterationStatus& status()

Return the status associated to the entity.