tuxemon.entity module

class tuxemon.entity.Entity(*, slug='', world)[source]

Bases: Generic[SaveDict]

Entity in the game.

Eventually a class for all things that exist on the game map, like NPCs, players, objects, etc.

Need to refactor in most NPC code to here. Need to refactor -out- all drawing/sprite code. Consider to refactor out world position/movement into “Body” class.

get_state(session)[source]

Get Entities internal state for saving/loading.

Parameters:

session (Session) – Game session.

Return type:

SaveDict

property moving: bool

Return True if the entity is moving.

pos_update()[source]

WIP. Required to be called after position changes.

Return type:

None

set_position(pos)[source]

Set the entity’s position in the game world.

Parameters:

pos (Sequence[float]) – Position to be set.

Return type:

None

set_state(session, save_data)[source]

Recreates entity from saved data.

Parameters:
  • session (Session) – Game session.

  • ave_data – Data used to recreate the Entity.

  • save_data (SaveDict) –

Return type:

None

stop_moving()[source]

Completely stop all movement.

Return type:

None

update_physics(td)[source]

Move the entity according to the movement vector.

Parameters:

td (float) – Time delta (elapsed time).

Return type:

None