-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmanage.py
50 lines (42 loc) · 1.27 KB
/
manage.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
''' The manage class
# Manage class manages score,
# printing, and the killing of Bomberman.'''
class Manage():
'''main class to manage scores, lives'''
score = 0
lives = 2
time = 120
# Function to printthe Header (score, time, lives)
def printhead(self):
'''prints the header'''
print("")
print("TIME LEFT : " + str(Manage.time))
print("YOUR SCORE IS : " + str(Manage.score) +
"\t\t\t\t\t\t LIVES LEFT : " + str(Manage.lives))
print("")
# Function to alter score
def changescore(self, deleted):
'''changes the score'''
if deleted == 'brick':
Manage.score += 10
if deleted == 'enemy':
Manage.score += 100
# Function to alter lives
def changelives(self):
'''changes lives'''
if Manage.lives == 0:
print('GAME OVER')
print('Your Final Score is : ' + str(Manage.score))
print('')
quit()
else:
Manage.lives -= 1
# timer for functionality
def timer(self):
'''maintains timer'''
if Manage.time == 0:
print("Sorry, you ran out of time.")
print("GAME OVER")
quit()
else:
Manage.time -= 1