Return to repo list

gatemender

Arcade game about fixing warp gates. LibreJam Dec 2020 Entry.
Return to HMagellan.com

commit 333bb36bf853153bfcbcaa610b762f48a758803e
parent 521bd3211315b2de25039198ab1685e6f567a79c
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Tue, 15 Dec 2020 16:22:43 -0600

Now earn an extra life by scoring 10,000 pts

Diffstat:
Msrc/game.py | 14+++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/game.py b/src/game.py @@ -40,6 +40,8 @@ class Game(object): # Others self.score = 0 + self.oldscore = 0 + self.lifeup_score = 0 self.level_factor = 1 self.lives = 2 self.transition_timer_max = 200 @@ -172,7 +174,6 @@ class Game(object): self.play_sound("Game_Music", 0) elif mode == MODES.Transition: pygame.mixer.stop() - self.lives_text = self.font.render(" X " + str(self.lives), False, (255, 255, 255)) self.level_text = self.font.render("GATE " + str(self.level_factor), False, (255, 255, 255)) self.transition_timer = self.transition_timer_max elif mode == MODES.GameOver: @@ -183,6 +184,8 @@ class Game(object): self.play_sound("Main_Menu_Music", 0) self.lives = 2 self.score = 0 + self.oldscore = 0 + self.lifeup_score = 0 self.level_factor = 1 self.preserve_gate = False elif mode == MODES.Options: @@ -334,6 +337,7 @@ class Game(object): else: self.screen.blit(self.images["Info"], (0, 0)) elif self.mode == MODES.Transition: + self.lives_text = self.font.render(" X " + str(self.lives), False, (255, 255, 255)) self.screen.fill((0, 0, 0)) self.screen.blit(self.images["Ship"], (self.screen_rect.centerx - 30, 280)) self.screen.blit(self.lives_text, (self.screen_rect.centerx + 30, 280)) @@ -351,6 +355,14 @@ class Game(object): pygame.display.update() def update_logic(self): + # Non-modal logic + self.lifeup_score += self.score - self.oldscore + self.oldscore = self.score + if self.lifeup_score >= 10000: + self.lifeup_score -= 10000 + self.lives += 1 + self.play_sound("Complete", 0, True, 0, False) + # Modal if self.mode == MODES.Play: self.spawn_asteroids() self.check_gate_complete()