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.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): x, y = self.graphics.iso_transform(self.x, self.y) occlusion = self.graphics.get_distance((self.x, self.y), self.engine.cursor_pos) / 4 # Set color based on selection status color = (255, 255, 0, 255) if self.selected else (0, 255, 0, 255) self.graphics.draw_square(self.x, self.y, color=color, margin=4) 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)