25 lines
938 B
Python
25 lines
938 B
Python
import math
|
|
from Ghost import Ghost
|
|
from Vec import Vec
|
|
|
|
|
|
class Blinky(Ghost):
|
|
|
|
def __init__(self, start_position: Vec, start_size: Vec, cell_count,
|
|
grid_cell_size, player, maze_grid, start_delay):
|
|
super().__init__(start_position, start_size, cell_count, grid_cell_size, player, maze_grid, start_delay)
|
|
|
|
self.current_idle_point = Vec(2, 1)
|
|
|
|
# Aktiviert den Idle-Mode von Blinky:
|
|
# Er bewegt sich zu seinem definierten Idle-Point.
|
|
def idle(self):
|
|
self.move_to_point(self.current_idle_point)
|
|
|
|
# Aktiviert den Hunting-Mode von Blinky:
|
|
# Er bewegt sich zu der aktuellen Position des Spielers.
|
|
def hunting(self):
|
|
player_pos = Vec(math.floor((self.player.position.x + self.grid_cell_size / 2) / self.grid_cell_size),
|
|
math.floor((self.player.position.y + self.grid_cell_size / 2) / self.grid_cell_size))
|
|
self.move_to_point(player_pos)
|