Return to repo list

gatemender

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

commit d89b7ad48fc46c626cf0624911c25cfda090fc2b
parent 1ad3789a206c4ad30b964b6fd55fc3cdea1d245d
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Mon,  7 Dec 2020 12:03:55 -0600

ui now complete, score displayed

Diffstat:
Msrc/game.py | 17+++++++++++------
Msrc/sprites.py | 2+-
2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/game.py b/src/game.py @@ -65,6 +65,7 @@ class Game(object): self.hp_meter_fill = None self.burst_meter = None self.burst_meter_fill = None + self.score_surface = None self.asteroid_spawn_timer = 100 def load_level(self): @@ -124,7 +125,7 @@ class Game(object): self.alpha_icon = sprites.CustomSprite(self, self.images["Big_Alpha_Icon"], (410, 710)) self.beta_icon = sprites.CustomSprite(self, self.images["Big_Beta_Icon"], (490, 710)) self.gamma_icon = sprites.CustomSprite(self, self.images["Big_Gamma_Icon"], (570, 710)) - self.hud_lives_icon = sprites.CustomSprite(self, self.images["Ship"], (130, 720)) + self.hud_lives_icon = sprites.CustomSprite(self, self.images["Ship"], (100, 720)) self.screen_draw_group.add(self.alpha_icon, self.beta_icon, self.gamma_icon, self.hud_lives_icon) def change_mode(self, mode): @@ -151,17 +152,17 @@ class Game(object): self.num_gamma_rect.center = (600, 710) self.num_lives = self.font.render("X " + str(self.lives), False, (255, 255, 255)) self.num_lives_rect = self.num_lives.get_rect() - self.num_lives_rect.center = (180, 720) + self.num_lives_rect.center = (150, 720) self.hp_heading = self.font.render("HP", False, (255, 255, 255)) self.hp_heading_rect = self.hp_heading.get_rect() - self.hp_heading_rect.center = (61, 720) + self.hp_heading_rect.center = (41, 720) self.hp_meter = pygame.Surface((32, 80)) self.hp_meter.fill((135, 0, 22)) self.hp_meter_rect = self.hp_meter.get_rect() self.hp_meter_fill = pygame.Surface((32, round((self.ship.hp / 3) * 80))) self.hp_meter_fill.fill((0, 200, 0)) self.hp_meter_fill_rect = self.hp_meter_fill.get_rect() - self.hp_meter_rect.center = (60, 720) + self.hp_meter_rect.center = (40, 720) self.hp_meter_fill_rect.bottom = self.hp_meter_rect.bottom - 1 self.hp_meter_fill_rect.centerx = self.hp_meter_rect.centerx burst_fill_colo = (0, 0, 200) @@ -169,16 +170,19 @@ class Game(object): burst_fill_colo = (255, 255, 255) self.burst_heading = self.font.render("BURST", False, (0, 255, 255)) self.burst_heading_rect = self.burst_heading.get_rect() - self.burst_heading_rect.center = (820, 720) + self.burst_heading_rect.center = (240, 720) self.burst_meter = pygame.Surface((100, 32)) self.burst_meter.fill((135, 0, 22)) self.burst_meter_rect = self.burst_meter.get_rect() self.burst_meter_fill = pygame.Surface((self.ship.burst_counter, 32)) self.burst_meter_fill.fill(burst_fill_colo) self.burst_meter_fill_rect = self.burst_meter_fill.get_rect() - self.burst_meter_rect.center = (816, 720) + self.burst_meter_rect.center = (236, 720) self.burst_meter_fill_rect.bottom = self.burst_meter_rect.bottom - 1 self.burst_meter_fill_rect.centerx = self.burst_meter_rect.centerx + self.score_surface = self.font.render("SCORE: " + str(self.score), False, (255, 255, 255)) + self.score_surface_rect = self.score_surface.get_rect() + self.score_surface_rect.topleft = (740, 700) def shift_frames(self): self.frameclock.tick(FRAMERATE) @@ -225,6 +229,7 @@ class Game(object): self.screen.blit(self.burst_meter, self.burst_meter_rect) self.screen.blit(self.burst_meter_fill, self.burst_meter_fill_rect) self.screen.blit(self.burst_heading, self.burst_heading_rect) + self.screen.blit(self.score_surface, self.score_surface_rect) elif self.mode == MODES.Transition: self.screen.fill((0, 0, 0)) self.screen.blit(self.lives_text, (100, 100)) diff --git a/src/sprites.py b/src/sprites.py @@ -69,7 +69,7 @@ class Ship(CustomSprite): self.blinking_timer = self.blinking_timer_max self.aura = FixAura(self.manager, self.manager.images["Fix_Aura"], self.rect.center, 0, self) self.manager.camera_draw_group.add(self.aura) - self.materials = { m : 5 for m in MATERIALS } + self.materials = { m : 0 for m in MATERIALS } self.be_dead_timer = 60 self.burst_counter = 100 self.burst_delay = 2 + self.manager.level_factor