phc: fix speed propperty

This commit is contained in:
Dmitry Belyaev 2024-04-01 00:51:52 +03:00
parent 49f15f9a21
commit 71d5115ac1

View File

@ -299,11 +299,11 @@ class Hero(GameObject):
@property
def speed(self):
return self._speed
return max(self._speed, 1)
@speed.setter
def speed(self, value):
self._speed = value % 14 + 1
self._speed = value % 16
def _reduce_step(self, coords):
"""Уменьшение шага движения, с целью подойти вплотную к стене"""
@ -357,7 +357,7 @@ class Hero(GameObject):
def move(self, direction: Coords, step: int = 1):
self.update_direction(direction)
self.coords += direction * step * self._speed // 3
self.coords += direction * step * self.speed // 3
self.scene.coins.collect(self.rect)
def move_left(self, step: int = 1):