You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.1 KiB

class Entity:
def __init__(self, asset, x, y, action, direction, speed, engine):
self.asset = asset
self.graphics = engine.graphics
self.x = x
self.y = y
self.next_cell = (x, y)
self.iso_x, self.iso_y = self.graphics.iso_transform(self.x, self.y)
self.action = action
self.direction = direction
self.speed = speed
self.frame = 0
self.engine = engine
self.selected = True
self.movement = 0
def update(self):
occlusion = self.graphics.get_distance((self.x, self.y), self.engine.cursor_pos) / 4
# Set color based on selection status
color = (0, 255, 0, 255)
if self.selected:
self.graphics.draw_square(self.iso_x, self.iso_y, color=color, margin=4)
# Draw target indicator if target is set
occlusion = self.graphics.map_shadow[self.y][self.x]
if occlusion >= 0.8:
return
self.frame = self.graphics.render_sprite(f"{self.asset}_{self.action}_dir{self.direction}", self.iso_x, self.iso_y, self.frame, occlusion)