mirror of
https://github.com/n0remac/game-jam-2020.git
synced 2025-12-11 04:05:24 -06:00
fix activateGhost and Frog functions, refactor & cleanup
This commit is contained in:
@@ -197,19 +197,18 @@ class Enemy(Mob):
|
|||||||
A on_update function, the Mob should decide it's next actions here.
|
A on_update function, the Mob should decide it's next actions here.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
curpos, nextpos = self.nearestPosition(), path[1]
|
curPos, nextPos = self.nearestPosition(), path[1] if len(path) > 1 else self.target.position
|
||||||
# print(curpos, nextpos)
|
|
||||||
|
|
||||||
if nextpos[0] > curpos[0]:
|
if nextPos[0] > curPos[0]:
|
||||||
self.change_x = Config.PLAYER_MOVEMENT_SPEED - 3
|
self.change_x = Config.PLAYER_MOVEMENT_SPEED - 3
|
||||||
elif nextpos[0] < curpos[0]:
|
elif nextPos[0] < curPos[0]:
|
||||||
self.change_x = -Config.PLAYER_MOVEMENT_SPEED + 3
|
self.change_x = -Config.PLAYER_MOVEMENT_SPEED + 3
|
||||||
else:
|
else:
|
||||||
self.change_x = 0
|
self.change_x = 0
|
||||||
|
|
||||||
if nextpos[1] > curpos[1]:
|
if nextPos[1] > curPos[1]:
|
||||||
self.change_y = Config.PLAYER_MOVEMENT_SPEED - 3
|
self.change_y = Config.PLAYER_MOVEMENT_SPEED - 3
|
||||||
elif nextpos[1] < curpos[1]:
|
elif nextPos[1] < curPos[1]:
|
||||||
self.change_y = -Config.PLAYER_MOVEMENT_SPEED + 3
|
self.change_y = -Config.PLAYER_MOVEMENT_SPEED + 3
|
||||||
else:
|
else:
|
||||||
self.change_y = 0
|
self.change_y = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user