Creepy-simulation
 
Loading...
Searching...
No Matches
entity_drawer.EntityDrawer Class Reference

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)
 

Detailed Description

@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.

Constructor & Destructor Documentation

◆ __init__()

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.

Member Function Documentation

◆ _set_target()

entity_drawer.EntityDrawer._set_target (   self,
  steps 
)
protected
Configures the movement steps and direction to the target position.

@param steps: The number of steps to reach the target position.

◆ draw_step()

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.

◆ update()

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.

◆ update_position()

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.

Member Data Documentation

◆ cur_x

entity_drawer.EntityDrawer.cur_x

◆ cur_y

entity_drawer.EntityDrawer.cur_y

◆ drawer

entity_drawer.EntityDrawer.drawer

◆ dx

entity_drawer.EntityDrawer.dx

◆ dy

entity_drawer.EntityDrawer.dy

◆ image

entity_drawer.EntityDrawer.image

◆ steps_left

entity_drawer.EntityDrawer.steps_left

◆ target_x

entity_drawer.EntityDrawer.target_x

◆ target_y

entity_drawer.EntityDrawer.target_y

The documentation for this class was generated from the following file: