Added maze constricted movement. /JL
This commit is contained in:
@@ -15,7 +15,7 @@ class ActorPacman:
|
||||
self.max_mouth_deg = 45
|
||||
self.animate_speed = 2
|
||||
self.mouth_closing = False
|
||||
self.location = start_location
|
||||
self.location = list(start_location)
|
||||
self.maze = maze
|
||||
|
||||
def update(self):
|
||||
@@ -53,18 +53,34 @@ class ActorPacman:
|
||||
def move_right(self):
|
||||
for _ in range(16):
|
||||
self.x += self.speed
|
||||
self.location[0] += 1
|
||||
if self.location[0] > 28:
|
||||
self.location[0] = 0
|
||||
self.x = 16
|
||||
|
||||
def move_left(self):
|
||||
for _ in range(16):
|
||||
self.x -= self.speed
|
||||
self.location[0] -= 1
|
||||
if self.location[0] < 0:
|
||||
self.location[0] = 28
|
||||
self.x = (32 * 29) - 16
|
||||
|
||||
def move_up(self):
|
||||
for _ in range(16):
|
||||
self.y -= self.speed
|
||||
self.location[1] -= 1
|
||||
if self.location[1] < 0:
|
||||
self.location[1] = 32
|
||||
self.y = (32 * 30) + 48
|
||||
|
||||
def move_down(self):
|
||||
for _ in range(16):
|
||||
self.y += self.speed
|
||||
self.location[1] += 1
|
||||
if self.location[1] > 32:
|
||||
self.location[1] = 0
|
||||
self.y = 48
|
||||
|
||||
def set_direction(self, dir: PlayerDirection):
|
||||
self.direction = dir
|
Reference in New Issue
Block a user