Bring timer back to Game class
This commit is contained in:
parent
df83f13bef
commit
f7fb38b7ff
@ -10,6 +10,7 @@ from game.Map import Map
|
||||
from src.entities.Pickupable import Pickupable
|
||||
from src.entities.Player import Player
|
||||
from src.entities.Statistics import Statistics
|
||||
from src.game.Timer import Timer
|
||||
|
||||
|
||||
class Game:
|
||||
@ -40,6 +41,11 @@ class Game:
|
||||
print("The screen cannot be in a vertical orientation. Exiting...")
|
||||
exit(1)
|
||||
|
||||
# Initialize timers
|
||||
self.pgTimer = pygame.time.Clock()
|
||||
self.ingameTimer = Timer()
|
||||
self.ingameTimer.startClock()
|
||||
|
||||
self.screen = Screen(self, self.config["window"])
|
||||
print("OK")
|
||||
|
||||
@ -49,11 +55,12 @@ class Game:
|
||||
self.map.addEntity(self.player)
|
||||
self.eventManager = EventManager(self, self.player)
|
||||
|
||||
|
||||
self.mainLoop()
|
||||
|
||||
def mainLoop(self):
|
||||
while self.running:
|
||||
# Update ingame clock
|
||||
self.ingameTimer.updateTime(self.pgTimer.tick())
|
||||
self.eventManager.handleEvents()
|
||||
self.spritesList.draw(self.screen.pygameScreen)
|
||||
pygame.display.flip()
|
||||
|
Loading…
Reference in New Issue
Block a user