-
Notifications
You must be signed in to change notification settings - Fork 2
/
Game.py
71 lines (55 loc) · 1.88 KB
/
Game.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from menu.Menu import Menu
from menu.Credits import Credits
from gameover.GameOver import GameOver
from collectables.Heart import Heart
from GamePlay import GamePlay
from pygame import mixer
import pygame
import os
import time
class Game:
def __init__(self):
self.__menu = Menu()
self.__credits = Credits()
self.__game_over = GameOver()
self.__game_play = GamePlay()
self.__start = False
self.__credits_action = False
self.__menu_action = False
self.__game_over_action = False
self.__pontuation = 0
mixer.music.load(
os.path.join('sound', 'sounds', 'Mc Fioti - Bum Bum Tam Tam.wav')
)
mixer.music.set_volume(0.5)
mixer.music.play(-1)
pygame.init()
def load(self):
while True:
action = self.__menu.main()
if action == 'START':
self.__menu_action = False
self.__start = True
if action == 'CREDITS':
self.__credits_action = True
if action == 'MENU':
self.__menu_action = True
if action == 'GAMEOVER':
self.__game_over = True
while self.__menu_action:
action = self.__menu.main()
self.__menu_action = False
while self.__credits_action:
action = self.__credits.main()
self.__credits_action = False
self.__menu_action = True
while self.__start:
pontuation = self.__game_play.playing(self.__start)
self.__pontuation = pontuation
self.__game_over_action = True
self.__start = False
while self.__game_over_action:
self.__game_over.main(self.__pontuation)
self.__init__()
if __name__ == "__main__":
Game().load()