More work and fixes on the bonus.

This commit is contained in:
Storm Dragon 2019-12-08 14:48:46 -05:00
parent 69d4316067
commit c8e9033508

View File

@ -13,9 +13,11 @@ pygame.mixer.set_reserved(2)
def butthead_taunt(sounds): def butthead_taunt(sounds):
global bonus global bonus
global bonusTime
global points global points
play_random(sounds, "butt-head") play_random(sounds, "butt-head")
bonus = True bonus = True
bonusTime = time.time()
def monkey_taunt(): def monkey_taunt():
t = pygame.mixer.Channel(1) t = pygame.mixer.Channel(1)
@ -47,6 +49,7 @@ def player_action(monkey, reaction):
def game(mode): def game(mode):
pygame.mixer.music.pause() pygame.mixer.music.pause()
global bonus global bonus
global bonusTime
bonusTime = int(time.time()) bonusTime = int(time.time())
encourage = int(time.time()) encourage = int(time.time())
lose = False lose = False
@ -95,15 +98,14 @@ def game(mode):
if lose == True: continue if lose == True: continue
taunt = monkey_taunt() taunt = monkey_taunt()
timeOut = time.time() timeOut = time.time()
elif (event.key == pygame.K_SPACE) and (bonus == True): elif event.key == pygame.K_SPACE and bonus == True:
bonus == False bonus = False
points += 100 points += 100
k = pygame.mixer.Channel(0) k = pygame.mixer.Channel(0)
k.play(sounds['kick-hit']) k.play(sounds['kick-hit'])
pygame.event.clear() pygame.event.clear()
if bonusTime - time.time() > 0.75: if time.time() - bonusTime > 0.85:
bonus = False bonus = False
bonusTime = time.time()
totalTime = time.time() totalTime = time.time()
if int(time.time()) - encourage == 8: if int(time.time()) - encourage == 8:
if random.randrange(0, 5) < 2: if random.randrange(0, 5) < 2:
@ -134,6 +136,7 @@ def game(mode):
mode = game_menu("start game", "instructions", "donate", "credits", "learn sounds", "exit_game") mode = game_menu("start game", "instructions", "donate", "credits", "learn sounds", "exit_game")
while mode != "exit_game": while mode != "exit_game":
bonus = False bonus = False
bonusTime = time.time()
spanks = 0 spanks = 0
points = 0 points = 0
if mode == "menu": mode = game_menu("start game", "instructions", "donate", "credits", "learn sounds", "exit_game") if mode == "menu": mode = game_menu("start game", "instructions", "donate", "credits", "learn sounds", "exit_game")