Merge branch 'passingEvents' of C:\Users\Paul\Desktop\DSZI_Survival with conflicts.

This commit is contained in:
jonspacz 2020-04-05 23:43:23 +02:00
parent fd3f7180c8
commit 86d9efe837

View File

@ -6,8 +6,10 @@ from os import path
from game.EventManager import EventManager from game.EventManager import EventManager
from game.Screen import Screen from game.Screen import Screen
from game.Map import Map from game.Map import Map
from src.entities.Pickupable import Pickupable
from src.entities.Player import Player from src.entities.Player import Player
from src.game.Timer import Timer from src.entities.Statistics import Statistics
class Game: class Game:
@ -38,11 +40,6 @@ class Game:
print("The screen cannot be in a vertical orientation. Exiting...") print("The screen cannot be in a vertical orientation. Exiting...")
exit(1) exit(1)
# Initialize timers
self.pgTimer = pygame.time.Clock()
self.ingameTimer = Timer()
self.ingameTimer.startClock()
self.screen = Screen(self, self.config["window"]) self.screen = Screen(self, self.config["window"])
print("OK") print("OK")
@ -52,13 +49,11 @@ class Game:
self.map.addEntity(self.player) self.map.addEntity(self.player)
self.eventManager = EventManager(self, self.player) self.eventManager = EventManager(self, self.player)
self.mainLoop() self.mainLoop()
def mainLoop(self): def mainLoop(self):
while self.running: while self.running:
# Update ingame clock
self.ingameTimer.updateTime(self.pgTimer.tick())
self.eventManager.handleEvents() self.eventManager.handleEvents()
self.spritesList.draw(self.screen.pygameScreen) self.spritesList.draw(self.screen.pygameScreen)
pygame.display.flip() pygame.display.flip()