From 2573d37d1adf6d9d6fdcfc8a1c5f9bb402597e76 Mon Sep 17 00:00:00 2001 From: s444427 Date: Fri, 3 Apr 2020 20:37:46 +0200 Subject: [PATCH] bugfix Waiter out of matrix --- src/waiter.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/waiter.py b/src/waiter.py index c1a5abc..faf2715 100644 --- a/src/waiter.py +++ b/src/waiter.py @@ -13,11 +13,9 @@ class Waiter(pygame.sprite.Sprite): # Borders def move(self, x, y): - if 0 <= self.X + x <= 13: - if self.matrix.walk_through(self.X, self.Y) == 1: + if 0 <= self.X + x <= 13 and 0 <= self.Y + y <= 14: + if self.matrix.walk_through(self.X + x, self.Y + y) == 1: self.X += x - if 0 <= self.Y + y <= 14: - if self.matrix.walk_through(self.X, self.Y) == 1: self.Y += y def update(self, event):