From cf0a4be82f0b42ee51ac38e8c0fc5b5d1439faf9 Mon Sep 17 00:00:00 2001 From: Mateusz Date: Wed, 27 May 2020 00:57:53 +0200 Subject: [PATCH] algorithm and movement work --- src/entities/Player.py | 6 +++--- src/game/EventManager.py | 8 ++++++++ src/game/Game.py | 13 ++++++++++--- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/entities/Player.py b/src/entities/Player.py index bd77870..f71c946 100644 --- a/src/entities/Player.py +++ b/src/entities/Player.py @@ -55,13 +55,13 @@ class Player(Entity): """ # looses hunger # self.statistics.set_hunger(1.7) - self.statistics.set_hunger(0.7) + self.statistics.set_hunger(0.5) # gets more thirsty # self.statistics.set_thirst(2.2) - self.statistics.set_thirst(1.2) + self.statistics.set_thirst(0.5) # gets tired # self.statistics.set_stamina(-1.9) - self.statistics.set_stamina(-0.9) + self.statistics.set_stamina(-0.5) def applyTimeFatigue(self): """ diff --git a/src/game/EventManager.py b/src/game/EventManager.py index eb5ba00..8789821 100644 --- a/src/game/EventManager.py +++ b/src/game/EventManager.py @@ -24,6 +24,8 @@ class EventManager: # TODO: Make this not retarded self.turnOff = False + self.iterator = 0 + # TODO def loadKeyboardSettings(self): pass @@ -112,6 +114,12 @@ class EventManager: target = pickEntity(self.player, self.game.map) self.player.gotoToTarget(target, self.game.map) + if keys[pygame.K_t]: + if self.player.movementTarget is None: + target = self.game.entityToVisitList[self.iterator] + self.player.gotoToTarget(target, self.game.map) + self.iterator += 1 + if keys[pygame.K_r]: self.game.map.respawn() diff --git a/src/game/Game.py b/src/game/Game.py index a5be113..e5e51cc 100644 --- a/src/game/Game.py +++ b/src/game/Game.py @@ -422,9 +422,16 @@ class Game: ga = GeneticAlgorithm(firstGeneration, mutationProbability) movementList = ga.listOfTravel() - print(movementList) - print(type(movementList)) - print(movementList[0]) + + self.entityToVisitList = [] + for i in movementList: + self.entityToVisitList.append(self.map.getEntityOnCoord(i)) + + self.entityToVisitList.remove(self.entityToVisitList[0]) + + # for i in entityToVisitList: + # self.player.gotoToTarget(i, self.map) + # print("ile") # Start game loop self.mainLoop()