The score in Blinka Jump is actually a count of the time that the game has been running using time.monotonic(). The score is displayed in the score_area text object and is updated constantly throughout the game.
# gets time.monotonic() to have a running score mono = time.monotonic() score = mono - start # adds 10 points every time a Sparky is cleared total_score = score + jump_score # displays score as text score_area.text = int(total_score)
In addition to the time.monotonic() component of the score, every time Blinka jumps over a Sparky you get a 10 point bonus. The game counts a successful jump by checking if a Sparky is at x coordinate 8 and Blinka is jumping. This bonus score is stored in jump_score and is added to the running total_score.
Two tones are also played (a triumphant perfect fifth) every time Blinka clears a Sparky.
for j in range(3):
if sparky_x[j] == 8 and not cleared:
# 10 points to the player
bonus += 1
jump_score = bonus * 10
cleared = True
# special victory tone is played
simpleio.tone(board.SPEAKER, 523.25, 0.005)
simpleio.tone(board.SPEAKER, 783.99, 0.005)
Page last edited March 08, 2024
Text editor powered by tinymce.