Public Member Functions | |
| __init__ (self, tuple[float, float] position, image, drawer) | |
| update (self, tuple[float, float] new_position, steps, state=None) | |
| update_position (self) | |
| draw_step (self) | |
Public Attributes | |
| drawer | |
| cur_x | |
| cur_y | |
| target_x | |
| target_y | |
| steps_left | |
| image | |
| dx | |
| dy | |
Protected Member Functions | |
| _set_target (self, steps) | |
@class EntityDrawer @brief Base class for drawing and updating the position of entities in the simulation. The EntityDrawer class manages the position, movement, and rendering of entities.
| entity_drawer.EntityDrawer.__init__ | ( | self, | |
| tuple[float, float] | position, | ||
| image, | |||
| drawer | |||
| ) |
Initializes an EntityDrawer object. @param position: The initial position of the entity. @param image: The image used for rendering the entity. @param drawer: The drawer object managing the rendering context.
|
protected |
Configures the movement steps and direction to the target position. @param steps: The number of steps to reach the target position.
| entity_drawer.EntityDrawer.draw_step | ( | self | ) |
Updates the position and renders the entity on the screen. Ensures that the entity is only rendered if it is within the visible bounds.
| entity_drawer.EntityDrawer.update | ( | self, | |
| tuple[float, float] | new_position, | ||
| steps, | |||
state = None |
|||
| ) |
Updates the target position and movement steps for the entity. @param new_position: The new target position of the entity. @param steps: The number of steps required to reach the target position. @param state: Optional state information for the entity.
| entity_drawer.EntityDrawer.update_position | ( | self | ) |
Updates the current position of the entity based on its movement steps. @return: True if the entity has remaining steps to move, otherwise False.
| entity_drawer.EntityDrawer.cur_x |
| entity_drawer.EntityDrawer.cur_y |
| entity_drawer.EntityDrawer.drawer |
| entity_drawer.EntityDrawer.dx |
| entity_drawer.EntityDrawer.dy |
| entity_drawer.EntityDrawer.image |
| entity_drawer.EntityDrawer.steps_left |
| entity_drawer.EntityDrawer.target_x |
| entity_drawer.EntityDrawer.target_y |