phc: fix speed propperty
This commit is contained in:
parent
49f15f9a21
commit
71d5115ac1
@ -299,11 +299,11 @@ class Hero(GameObject):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def speed(self):
|
def speed(self):
|
||||||
return self._speed
|
return max(self._speed, 1)
|
||||||
|
|
||||||
@speed.setter
|
@speed.setter
|
||||||
def speed(self, value):
|
def speed(self, value):
|
||||||
self._speed = value % 14 + 1
|
self._speed = value % 16
|
||||||
|
|
||||||
def _reduce_step(self, coords):
|
def _reduce_step(self, coords):
|
||||||
"""Уменьшение шага движения, с целью подойти вплотную к стене"""
|
"""Уменьшение шага движения, с целью подойти вплотную к стене"""
|
||||||
@ -357,7 +357,7 @@ class Hero(GameObject):
|
|||||||
|
|
||||||
def move(self, direction: Coords, step: int = 1):
|
def move(self, direction: Coords, step: int = 1):
|
||||||
self.update_direction(direction)
|
self.update_direction(direction)
|
||||||
self.coords += direction * step * self._speed // 3
|
self.coords += direction * step * self.speed // 3
|
||||||
self.scene.coins.collect(self.rect)
|
self.scene.coins.collect(self.rect)
|
||||||
|
|
||||||
def move_left(self, step: int = 1):
|
def move_left(self, step: int = 1):
|
||||||
|
Loading…
Reference in New Issue
Block a user