Scoreboard partially implemented.

This commit is contained in:
Storm Dragon 2019-12-11 09:49:18 -05:00
parent 5ea0a9be01
commit e7011ce8f3
2 changed files with 5 additions and 8 deletions

@ -1 +1 @@
Subproject commit f2326c628c6eddff9f60ea8c0eeca6bbb93dae0a
Subproject commit 08f06699c8d5df9034da56d536d6f5b73809ff45

View File

@ -14,7 +14,6 @@ pygame.mixer.set_reserved(2)
def butthead_taunt(sounds):
global bonus
global bonusTime
global points
play_random(sounds, "butt-head")
bonus = True
bonusTime = time.time()
@ -32,7 +31,6 @@ def monkey_taunt():
def player_action(monkey, reaction):
if monkey != reaction: return True
global points
global spanks
left = 0.7
right = 0.7
@ -41,7 +39,7 @@ def player_action(monkey, reaction):
p = pygame.mixer.Channel(2)
p.play(sounds['spank-hit'])
p.set_volume(left, right)
points += 10
score.Increase_Score(10)
spanks += 1
return False
@ -56,7 +54,6 @@ def game(mode):
cut_scene(sounds, 'start-game')
startTime = time.time()
totalTime = startTime
global points
global spanks
taunt = monkey_taunt()
timeOut = time.time()
@ -100,7 +97,7 @@ def game(mode):
timeOut = time.time()
elif event.key == pygame.K_SPACE and bonus == True:
bonus = False
points += 100
score.Increase_Score(100)
k = pygame.mixer.Channel(0)
k.play(sounds['kick-hit'])
pygame.event.clear()
@ -127,7 +124,7 @@ def game(mode):
message.append("You averaged " + str(round(spanks / (totalTime - startTime), 2)) + " monkey spanks per second.")
except:
message.append("You averaged 0.00 monkey spanks per second.")
message.append("You scored " + str(points) + " points.")
message.append("You scored " + str(score.Get_Score()) + " points.")
time.sleep(0.1)
display_text(message)
return "menu"
@ -137,8 +134,8 @@ mode = game_menu(sounds, "start game", "instructions", "donate", "credits", "lea
while mode != "exit_game":
bonus = False
bonusTime = time.time()
score = scoreboard()
spanks = 0
points = 0
if mode == "menu": mode = game_menu(sounds, "start game", "instructions", "donate", "credits", "learn sounds", "exit_game")
if mode == "start game": mode = game(mode)
if mode == "learn sounds": mode = learn_sounds(sounds)