Updated A* function calls
This commit is contained in:
parent
3ac188103a
commit
d6cf76f6bc
@ -5,7 +5,7 @@ import pygame
|
|||||||
|
|
||||||
from src.entities.Interactable import Interactable
|
from src.entities.Interactable import Interactable
|
||||||
from src.entities.Pickupable import Pickupable
|
from src.entities.Pickupable import Pickupable
|
||||||
from src.entities.Player import Movement
|
from entities.Enums import Movement
|
||||||
|
|
||||||
|
|
||||||
class EventManager:
|
class EventManager:
|
||||||
@ -57,7 +57,7 @@ class EventManager:
|
|||||||
clicked_collidables = [s for s in self.game.map.collidables if s.rect.collidepoint(pos)]
|
clicked_collidables = [s for s in self.game.map.collidables if s.rect.collidepoint(pos)]
|
||||||
|
|
||||||
if len(clicked_collidables) > 0:
|
if len(clicked_collidables) > 0:
|
||||||
self.game.movement.gotoToTarget(Random().choice(clicked_collidables))
|
self.player.gotoToTarget(Random().choice(clicked_collidables), self.game.map)
|
||||||
else:
|
else:
|
||||||
# get a list of all terrains that are under the mouse cursor
|
# get a list of all terrains that are under the mouse cursor
|
||||||
clicked_terrains = [tile for tile in self.game.map.terrainTilesList if tile.rect.collidepoint(pos)]
|
clicked_terrains = [tile for tile in self.game.map.terrainTilesList if tile.rect.collidepoint(pos)]
|
||||||
@ -96,9 +96,7 @@ class EventManager:
|
|||||||
if keys[pygame.K_u]:
|
if keys[pygame.K_u]:
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
self.game.movement.gotoToTarget(Random().choice(self.game.map.entities))
|
self.player.gotoToTarget(Random().choice(self.game.map.entities), self.game.map)
|
||||||
break
|
break
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user