Return to repo list

gatemender

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

commit e87b7cc4f287c8ebdadb0dafd842e9b4f03976f3
parent 21b469649189d12116a93a113be150180d18a41a
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Tue, 15 Dec 2020 00:03:58 -0600

Added sound fx

Diffstat:
MLICENSE | 2+-
Adata/appear.ogg | 0
Adata/chime.ogg | 0
Adata/click.ogg | 0
Adata/complete.ogg | 0
Adata/damage.ogg | 0
Adata/explode.ogg | 0
Adata/fix.ogg | 0
Adata/flash.ogg | 0
Adata/pickup.ogg | 0
Adata/repair.ogg | 0
Adata/shoot.ogg | 0
Adata/thrust.ogg | 0
Mhs.json | 3++-
Msrc/constants.py | 25+++++++++++++------------
Msrc/game.py | 13+++++++++----
Msrc/sprites.py | 8++++++++
17 files changed, 33 insertions(+), 18 deletions(-)

diff --git a/LICENSE b/LICENSE @@ -5,7 +5,7 @@ Licensing details for Gatemender: MEDIA EXCEPTIONS: The following files are derived from other free sources, and are released under different licenses noted here: - 1) data/{level3.ogg,title_screen.ogg} - CC0, Derived from "5 Chiptunes (action)" by Juhani Junkala/SubSpaceAudio, taken from here: https://opengameart.org/content/5-chiptunes-action + 1) data/{*.ogg} - CC0, Derived from assets by Juhani Junkala/SubSpaceAudio, taken from here: https://opengameart.org/content/5-chiptunes-action and here: https://opengameart.org/content/512-sound-effects-8-bit-style Following is the text of all licenses mentioned above: ##################### diff --git a/data/appear.ogg b/data/appear.ogg Binary files differ. diff --git a/data/chime.ogg b/data/chime.ogg Binary files differ. diff --git a/data/click.ogg b/data/click.ogg Binary files differ. diff --git a/data/complete.ogg b/data/complete.ogg Binary files differ. diff --git a/data/damage.ogg b/data/damage.ogg Binary files differ. diff --git a/data/explode.ogg b/data/explode.ogg Binary files differ. diff --git a/data/fix.ogg b/data/fix.ogg Binary files differ. diff --git a/data/flash.ogg b/data/flash.ogg Binary files differ. diff --git a/data/pickup.ogg b/data/pickup.ogg Binary files differ. diff --git a/data/repair.ogg b/data/repair.ogg Binary files differ. diff --git a/data/shoot.ogg b/data/shoot.ogg Binary files differ. diff --git a/data/thrust.ogg b/data/thrust.ogg Binary files differ. diff --git a/hs.json b/hs.json @@ -1 +1 @@ -{"SCORES": [500, 1000]} +{"SCORES": [500, 1000]}+ \ No newline at end of file diff --git a/src/constants.py b/src/constants.py @@ -51,8 +51,6 @@ IMAGE_FILES = { "Beta_Halo_Angle" : os.path.join("data", "beta_halo_angle.png"), "Gamma_Halo_Straight" : os.path.join("data", "gamma_halo_straight.png"), "Gamma_Halo_Angle" : os.path.join("data", "gamma_halo_angle.png"), -# "White_Halo_Straight" : os.path.join("data", "white_halo_straight.png"), -# "White_Halo_Angle" : os.path.join("data", "white_halo_angle.png"), "Alpha_Icon" : os.path.join("data", "alpha_material.png"), "Beta_Icon" : os.path.join("data", "beta_material.png"), "Gamma_Icon" : os.path.join("data", "gamma_material.png"), @@ -68,16 +66,19 @@ IMAGE_FILES = { } SOUND_FILES = { "Main_Menu_Music" : os.path.join("data", "title_screen.ogg"), - "Game_Music" : os.path.join("data", "level3.ogg") - #"Shoot" : os.path.join("data", ""), - #"Fix" : os.path.join("data", ""), - #"Explode" : os.path.join("data", ""), - #"Damage" : os.path.join("data", ""), - #"Thrust" : os.path.join("data", ""), - #"Appear" : os.path.join("data", ""), - #"Click" : os.path.join("data", ""), - #"Pickup" : os.path.join("data", ""), - #"Flash" : os.path.join("data", "") + "Game_Music" : os.path.join("data", "level3.ogg"), + "Shoot" : os.path.join("data", "shoot.ogg"), + "Fix" : os.path.join("data", "fix.ogg"), + "Explode" : os.path.join("data", "explode.ogg"), + "Damage" : os.path.join("data", "damage.ogg"), + "Chime" : os.path.join("data", "chime.ogg"), + "Thrust" : os.path.join("data", "thrust.ogg"), + "Appear" : os.path.join("data", "appear.ogg"), + "Click" : os.path.join("data", "click.ogg"), + "Pickup" : os.path.join("data", "pickup.ogg"), + "Flash" : os.path.join("data", "flash.ogg"), + "Repair" : os.path.join("data", "repair.ogg"), + "Complete" : os.path.join("data", "complete.ogg") } FONTPATH = os.path.join("data", "computerspeak03.ttf") MATERIALS = enum.Enum("MATERIALS", "Alpha Beta Gamma") diff --git a/src/game.py b/src/game.py @@ -47,6 +47,8 @@ class Game(object): self.asteroid_spawn_timer = 100 self.gate_defs = [] self.game_over_text = self.font.render("GAME OVER", False, (255, 255, 255)) + self.game_over_text_rect = self.game_over_text.get_rect() + self.game_over_text_rect.center = self.screen_rect.center self.lives_text = self.font.render(str(self.lives), False, (255, 255, 255)) self.level_text = self.font.render("GATE " + str(self.level_factor), False, (255, 255, 255)) self.title = self.images["Title"] @@ -289,13 +291,15 @@ class Game(object): self.play_sound("Main_Menu_Music", 0) else: self.music_on = False - pygame.mixer.stop() + self.channels[0].stop() elif self.sound_on_checkbox.rect.collidepoint(mousepos) and self.sound_on_checkbox.check_cooldown == 0: self.sound_on_checkbox.be_checked() if self.sound_on_checkbox.checked: - pass + self.sound_on = True + self.play_sound("Click", 1, True, 0, False) else: - pass + self.sound_on = False + self.channels[1].stop() elif self.options_back_button_rect.collidepoint(mousepos): self.change_mode(MODES.Menu) @@ -335,7 +339,7 @@ class Game(object): self.screen.blit(self.level_text, (self.screen_rect.centerx, 380)) elif self.mode == MODES.GameOver: self.screen.fill((0, 0, 0)) - self.screen.blit(self.game_over_text, (100, 100)) + self.screen.blit(self.game_over_text, self.game_over_text_rect) elif self.mode == MODES.Options: self.screen.fill((0, 0, 0)) self.screen.blit(self.music_on_label, self.music_on_label_rect) @@ -383,6 +387,7 @@ class Game(object): for g in self.gate_pieces.sprites(): if g.broken: return + self.play_sound("Complete", 0, True, 0, False) self.vortex.visible = True self.vortex.passthru = True diff --git a/src/sprites.py b/src/sprites.py @@ -73,6 +73,7 @@ class Ship(CustomSprite): self.burst_delay = 2 + self.manager.level_factor def thrust(self): + self.manager.play_sound("Thrust", 3, False, 0, False) if self.speed < SHIP_MAX_SPEED: self.speed += self.thrust_factor @@ -88,6 +89,7 @@ class Ship(CustomSprite): b = Bullet(self.manager, self.manager.images["Bullet"], self.rect.center, self.angle) self.manager.camera_draw_group.add(b) self.manager.bullets.add(b) + self.manager.play_sound("Shoot", 1, True, 0, False) def burst(self): for a in self.manager.asteroids: @@ -128,6 +130,7 @@ class Ship(CustomSprite): # Fixing if self.fixing: self.aura.visible = True + self.manager.play_sound("Fix", 2, False, 0, False) for g in self.manager.gate_pieces.sprites(): if self.rect.colliderect(g.rect) and g.broken and self.materials[g.requirement] > 0: self.fix_counter += 1 @@ -183,6 +186,7 @@ class Ship(CustomSprite): if self.hitbox.colliderect(s.rect): s.destroy() self.hp -= 1 + self.manager.play_sound("Damage", 0, True, 0, False) if self.hp > 0: self.blinking = True else: @@ -254,8 +258,10 @@ class GatePiece(CustomSprite): self.needed_text = self.manager.font.render(str(self.needed), False, (255, 255, 255)) self.needed_text_rect = self.needed_text.get_rect() self.needed_text_rect.center = rc + self.manager.play_sound("Chime", 0, True, 0, False) else: self.broken = False + self.manager.play_sound("Repair", 0, True, 0, False) self.halo_image = None self.halo_rect = None self.image = self.manager.images["Gate_" + self.or_name + "_Fixed"] @@ -284,6 +290,7 @@ class Asteroid(CustomSprite): def be_damaged(self): self.hp -= 1 if self.hp <= 0: + self.manager.play_sound("Explode", 0, True, 0, False) self.spawn_pickup() self.destroy() self.manager.score += 10 * self.manager.level_factor @@ -394,6 +401,7 @@ class Checkbox(CustomSprite): def be_checked(self): if self.check_cooldown == 0: + self.manager.play_sound("Click", 1, True, 0, False) if self.checked: self.checked = False self.image = self.unchecked_image