import pygame from domain.entities.entity import Entity from domain.world import World class Cat(Entity): def __init__(self, x: int, y: int, world: World): super().__init__(x, y, "CAT") self.world = world self.last_tick = pygame.time.get_ticks() self.cooldown = 1000 self.velocity = 1 self.busy = False self.direction = 0 def move(self, dx: int, dy: int): end_x = self.x + dx end_y = self.y + dy if end_x > self.world.width - 1 or end_y > self.world.height - 1 or end_x < 0 or end_y < 0: return self.world.obstacles[self.x][self.y].remove(self) self.x = end_x self.y = end_y self.world.obstacles[end_x][end_y].append(self)