algorithm and movement work

This commit is contained in:
Mateusz 2020-05-27 00:57:53 +02:00
parent 80c72f1ba0
commit cf0a4be82f
3 changed files with 21 additions and 6 deletions

View File

@ -55,13 +55,13 @@ class Player(Entity):
""" """
# looses hunger # looses hunger
# self.statistics.set_hunger(1.7) # self.statistics.set_hunger(1.7)
self.statistics.set_hunger(0.7) self.statistics.set_hunger(0.5)
# gets more thirsty # gets more thirsty
# self.statistics.set_thirst(2.2) # self.statistics.set_thirst(2.2)
self.statistics.set_thirst(1.2) self.statistics.set_thirst(0.5)
# gets tired # gets tired
# self.statistics.set_stamina(-1.9) # self.statistics.set_stamina(-1.9)
self.statistics.set_stamina(-0.9) self.statistics.set_stamina(-0.5)
def applyTimeFatigue(self): def applyTimeFatigue(self):
""" """

View File

@ -24,6 +24,8 @@ class EventManager:
# TODO: Make this not retarded # TODO: Make this not retarded
self.turnOff = False self.turnOff = False
self.iterator = 0
# TODO # TODO
def loadKeyboardSettings(self): def loadKeyboardSettings(self):
pass pass
@ -112,6 +114,12 @@ class EventManager:
target = pickEntity(self.player, self.game.map) target = pickEntity(self.player, self.game.map)
self.player.gotoToTarget(target, 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]: if keys[pygame.K_r]:
self.game.map.respawn() self.game.map.respawn()

View File

@ -422,9 +422,16 @@ class Game:
ga = GeneticAlgorithm(firstGeneration, mutationProbability) ga = GeneticAlgorithm(firstGeneration, mutationProbability)
movementList = ga.listOfTravel() movementList = ga.listOfTravel()
print(movementList)
print(type(movementList)) self.entityToVisitList = []
print(movementList[0]) 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 # Start game loop
self.mainLoop() self.mainLoop()