class documentation
class Entity(engine.Entity):
Represent a game entity with sprites, callbacks, and gameplay state.
Methods
- has_3d_sprite()
- Return whether the entity has a 3D sprite.
- set_3d_sprite_rotation(
rotation) - Set the 3D sprite rotation.
- set_3d_sprite_rotation(
- set_3d_sprite_scale(
scale) - Set the 3D sprite scale.
- set_3d_sprite_scale(
- update_3d_sprite_position()
- Synchronize the 3D sprite position.
- has_changed_position()
- Return whether the position changed.
- set_name(
name) - Set the entity name.
- set_name(
- set_type(
type) - Set the entity type.
- set_type(
- set_position(
position) - Set the entity position.
- set_position(
- position_set(
x,y,z,integer) - Set the entity position with optional z and integer component.
- position_set(
- set_old_position(
old_position) - Set the previous entity position.
- set_old_position(
- set_size(
size) - Set the entity size.
- set_size(
- set_is_8bit(
is_8bit) - Set the 8-bit graphics flag.
- set_is_8bit(
- set_is_active(
is_active) - Set the active flag.
- set_is_active(
- set_is_visible(
is_visible) - Set the visible flag.
- set_is_visible(
- set_is_player(
is_player) - Set the player flag.
- set_is_player(
- set_direction(
direction) - Set the facing direction.
- set_direction(
- direction_set(
x,y,z,integer) - Set the facing direction with optional z and integer component.
- direction_set(
- set_plane(
plane) - Set the camera plane.
- set_plane(
- plane_set(
x,y,z,integer) - Set the camera plane with optional z and integer component.
- plane_set(
- set_state(
state) - Set the gameplay state.
- set_state(
- set_start_position(
start_position) - Set the movement start position.
- set_start_position(
- set_end_position(
end_position) - Set the movement end position.
- set_end_position(
- set_move_timer(
move_timer) - Set the movement duration.
- set_move_timer(
- set_elapsed_move_timer(
elapsed_move_timer) - Set the elapsed movement time.
- set_elapsed_move_timer(
- set_radius(
radius) - Set the collision radius.
- set_radius(
- set_speed(
speed) - Set the movement speed.
- set_speed(
- set_attack_timer(
attack_timer) - Set the attack cooldown duration.
- set_attack_timer(
- set_elapsed_attack_timer(
elapsed_attack_timer) - Set the elapsed attack time.
- set_elapsed_attack_timer(
- set_strength(
strength) - Set the entity strength.
- set_strength(
- set_health(
health) - Set the current health.
- set_health(
- set_max_health(
max_health) - Set the maximum health.
- set_max_health(
- set_level(
level) - Set the entity level.
- set_level(
- set_xp(
xp) - Set the experience points.
- set_xp(
- set_health_regen(
health_regen) - Set the health regeneration rate.
- set_health_regen(
- set_elapsed_health_regen(
elapsed_health_regen) - Set the elapsed regeneration time.
- set_elapsed_health_regen(
- set_sprite_rotation(
sprite_rotation) - Set the 3D sprite rotation.
- set_sprite_rotation(
- set_sprite_scale(
sprite_scale) - Set the 3D sprite scale.
- set_sprite_scale(
- set_sprite3d_type(
type) - Set the 3D sprite type.
- set_sprite3d_type(
- set_sprite3d(
sprite3d) - Set the native 3D sprite reference.
- set_sprite3d(
- set_sprite(
sprite) - Set the main 2D sprite.
- set_sprite(
- set_sprite_left(
sprite_left) - Set the left-facing 2D sprite.
- set_sprite_left(
- set_sprite_right(
sprite_right) - Set the right-facing 2D sprite.
- set_sprite_right(
- __del__()
- Release the native entity resources.
| Parameters | |
| name | Entity name. |
| type | Entity type constant. |
| position | Initial entity position. |
| size | Entity size used for rendering and collision checks. |
| sprite | Main 2D sprite. Defaults to None. |
| sprite | Sprite used when facing left. Defaults to None. |
| sprite | Sprite used when facing right. Defaults to None. |
| start | Callback invoked when the entity starts. Defaults to None. |
| stop | Callback invoked when the entity stops. Defaults to None. |
| update | Callback invoked during entity updates. Defaults to None. |
| render | Callback invoked during entity rendering. Defaults to None. |
| collision | Callback invoked after a collision. Defaults to None. |
| is | Whether the entity uses 8-bit graphics. Defaults to False. |
| sprite | Initial 3D sprite type. Defaults to SPRITE_3D_NONE. |
| sprite | Initial 3D sprite color. Defaults to 0x0000. |
| Method | __setattr__ |
Set an entity attribute, routing to the matching setter. |
| Instance Variable | attack |
Attack cooldown duration. Writable. |
| Instance Variable | direction |
Entity facing direction. Writable. |
| Instance Variable | elapsed |
Time since the last attack. Writable. |
| Instance Variable | elapsed |
Time since the last health regeneration. Writable. |
| Instance Variable | elapsed |
Elapsed movement time. Writable. |
| Instance Variable | end |
Movement end position. Writable. |
| Instance Variable | ENTITY |
3D sprite entity type. |
| Instance Variable | ENTITY |
Attacked entity state. |
| Instance Variable | ENTITY |
Attacking entity state. |
| Instance Variable | ENTITY |
Dead entity state. |
| Instance Variable | ENTITY |
Enemy entity type. |
| Instance Variable | ENTITY |
Icon entity type. |
| Instance Variable | ENTITY |
Idle entity state. |
| Instance Variable | ENTITY |
Moving entity state. |
| Instance Variable | ENTITY |
Moving-to-end entity state. |
| Instance Variable | ENTITY |
Moving-to-start entity state. |
| Instance Variable | ENTITY |
Non-player character entity type. |
| Instance Variable | ENTITY |
Player entity type. |
| Instance Variable | health |
Current health. Writable. |
| Instance Variable | health |
Health regeneration rate. Writable. |
| Instance Variable | is |
Whether the entity uses 8-bit graphics. Writable. |
| Instance Variable | is |
Whether the entity participates in updates. Writable. |
| Instance Variable | is |
Whether the entity is the player. Writable. |
| Instance Variable | is |
Whether the entity is rendered. Writable. |
| Instance Variable | level |
Entity level. Writable. |
| Instance Variable | max |
Maximum health. Writable. |
| Instance Variable | move |
Movement duration. Writable. |
| Instance Variable | name |
Entity name. Writable. |
| Instance Variable | old |
Previous entity position. Writable. |
| Instance Variable | plane |
Entity camera plane. Writable. |
| Instance Variable | position |
Current entity position. Writable. |
| Instance Variable | radius |
Collision radius. Writable. |
| Instance Variable | size |
Entity size. Writable. |
| Instance Variable | speed |
Movement speed. Writable. |
| Instance Variable | sprite |
Main 2D sprite. Writable. |
| Instance Variable | sprite |
Native 3D sprite reference. Writable. |
| Instance Variable | SPRITE |
Custom 3D sprite. |
| Instance Variable | SPRITE |
House 3D sprite. |
| Instance Variable | SPRITE |
Humanoid 3D sprite. |
| Instance Variable | SPRITE |
No 3D sprite. |
| Instance Variable | SPRITE |
Pillar 3D sprite. |
| Instance Variable | SPRITE |
Tree 3D sprite. |
| Instance Variable | sprite |
3D sprite type. Writable. |
| Instance Variable | sprite |
Left-facing 2D sprite. Writable. |
| Instance Variable | sprite |
Right-facing 2D sprite. Writable. |
| Instance Variable | sprite |
3D sprite rotation. Writable. |
| Instance Variable | sprite |
3D sprite scale. Writable. |
| Instance Variable | start |
Movement start position. Writable. |
| Instance Variable | state |
Current gameplay state. Writable. |
| Instance Variable | strength |
Damage dealt by the entity. Writable. |
| Instance Variable | type |
Entity type constant. Writable. |
| Instance Variable | xp |
Experience points. Writable. |