diff --git a/src/tractor.py b/src/tractor.py index 1cc10031..b2831d6b 100644 --- a/src/tractor.py +++ b/src/tractor.py @@ -23,13 +23,13 @@ class Tractor(pygame.sprite.Sprite): load_dotenv(find_dotenv()) TILE_SIZE = int(os.getenv("TILE_SIZE")) - if direction == "up": + if direction == "up" and self.rect.y > 0: self.rect.y -= TILE_SIZE - elif direction == "down": + elif direction == "down" and self.rect.y < 15 * TILE_SIZE: self.rect.y += TILE_SIZE - elif direction == "left": + elif direction == "left" and self.rect.x > 0: self.rect.x -= TILE_SIZE - elif direction == "right": + elif direction == "right" and self.rect.x < 15 * TILE_SIZE: self.rect.x += TILE_SIZE def update(self):