Pressing 'u' now selects random interactable entity

This commit is contained in:
Marcin Kostrzewski 2020-05-15 08:54:49 +02:00
parent a40a598ffe
commit 492f37bda5

View File

@ -106,7 +106,9 @@ class EventManager:
if keys[pygame.K_u]: if keys[pygame.K_u]:
while True: while True:
try: try:
self.player.gotoToTarget(Random().choice(self.game.map.entities), self.game.map) from src.entities.Interactable import Interactable
self.player.gotoToTarget(Random().choice(self.game.map.getEntitiesByType(Interactable)),
self.game.map)
break break
except IndexError: except IndexError:
pass pass