From: Stefano Rivera Date: Sat, 17 May 2014 14:21:35 +0000 (+0200) Subject: MOAR sounds X-Git-Tag: 0.1~96^2~5 X-Git-Url: https://git.ctpug.org.za/?p=naja.git;a=commitdiff_plain;h=1f40f66ea696f9c1e5eb067f4327c94c8c2043ea MOAR sounds --- diff --git a/data/sounds/__init__.py b/data/sounds/__init__.py index 7794093..48f3e20 100644 --- a/data/sounds/__init__.py +++ b/data/sounds/__init__.py @@ -1,3 +1,4 @@ +import itertools import random from naja.gen_sound import Chunk, scale @@ -22,4 +23,16 @@ SOUNDS = { 'startup': scale(200, 801, 200), 'zoop': scale(500, 800, 20, length=0.01, volume=50), 'zzzzz': Chunk('sine', freq=100, length=0.5, volume=50), + 'yipee': itertools.chain( + scale(800, 1001, 50, length=0.1, volume=50), + scale(900, 1001, 50, length=0.1, volume=50), + ), + 'awwww': ( + Chunk('sine', freq=400, volume=50), + Chunk('sine', freq=250, length=0.5, volume=50), + ), + 'aha': ( + Chunk('sine', freq=1100, length=0.2, volume=50), + Chunk('sine', freq=1200, length=0.1, volume=50), + ), } diff --git a/data/sounds/aha.ogg b/data/sounds/aha.ogg new file mode 100644 index 0000000..84b3d0b Binary files /dev/null and b/data/sounds/aha.ogg differ diff --git a/data/sounds/awwww.ogg b/data/sounds/awwww.ogg new file mode 100644 index 0000000..7e91d97 Binary files /dev/null and b/data/sounds/awwww.ogg differ diff --git a/data/sounds/yipee.ogg b/data/sounds/yipee.ogg new file mode 100644 index 0000000..4e2c4f2 Binary files /dev/null and b/data/sounds/yipee.ogg differ diff --git a/naja/actions.py b/naja/actions.py index d73a66a..9f3b221 100644 --- a/naja/actions.py +++ b/naja/actions.py @@ -82,6 +82,7 @@ class LoseHealthOrMSB(LocationAction): def perform_action(self, board, location): if not self.check_and_clear_MSB(board.player): + sound.play_sound('awwww.ogg') board.lose_health() @@ -120,6 +121,7 @@ class LoseHealthOrMSBAndSetBits(LocationAction): def perform_action(self, board, location): if not self.check_and_clear_MSB(board.player): + sound.play_sound('awwww.ogg') board.lose_health() board.player.bits.set_bits(location.bitwise_operand) @@ -129,6 +131,7 @@ class AcquireWinToken(LocationAction): GLYPHS = (ACTION_GLYPHS.WINTOKEN,) def perform_action(self, board, location): + sound.play_sound('yipee.ogg') board.acquire_win_token() board.player.bits.clear_bits(set([ BITS.RED, BITS.GREEN, BITS.BLUE, @@ -140,6 +143,7 @@ class GainHealth(LocationAction): GLYPHS = (ACTION_GLYPHS.HEAL,) def perform_action(self, board, location): + sound.play_sound('aha.ogg') board.gain_health() @@ -149,6 +153,7 @@ class GainHealthAndClearBitsOrMSB(LocationAction): MSB_GLYPH = ACTION_GLYPHS.CLEAR_BITS def perform_action(self, board, location): + sound.play_sound('aha.ogg') board.gain_health() if not self.check_and_clear_MSB(board.player): board.player.bits.clear_bits(location.bitwise_operand)