-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLevelManager.py
49 lines (39 loc) · 1.41 KB
/
LevelManager.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from MainMenu import *
from Game import *
from GameOver import *
class LevelManager():
"""Keeps track of Game Status"""
def __init__(this, screen, events):
### Universal Components
this.screen = screen
this.events = events
### Window Options
this.currentWindow = 0
this.gameState = -1
this.mainMenu = MainMenu(screen, events, this)
this.game = this.mainMenu
this.gameOver = GameOver(screen, events, this, 60)
def Update(this):
this.UpdateWindow()
def UpdateWindow(this):
if (this.currentWindow == 0):
# Main Menu
this.mainMenu.Update(this.gameState)
elif (this.currentWindow == 1):
# Game
this.game.Update()
elif (this.currentWindow == 2):
# game over
this.gameOver.Update(this.gameState)
def GetWindow(this): # returns the current window index
return this.currentWindow
def GetGameState(this): # returns the current game state
return this.gameState
def SetWindow(this, window):
this.currentWindow = window
if (window == 0):
this.mainMenu = MainMenu(this.screen, this.events, this)
elif (window == 1):
this.game = Game(this.screen, this.events, this)
elif (window == 2):
this.gameOver = GameOver(this.screen, this.events, this, this.game.time)