diff --git a/pybottle/__pycache__/storm_games.cpython-35.pyc b/pybottle/__pycache__/storm_games.cpython-35.pyc new file mode 100644 index 0000000..1a74b86 Binary files /dev/null and b/pybottle/__pycache__/storm_games.cpython-35.pyc differ diff --git a/pybottle/bottle-blaster.py b/pybottle/bottle-blaster.py new file mode 100644 index 0000000..3155281 --- /dev/null +++ b/pybottle/bottle-blaster.py @@ -0,0 +1,23 @@ +#!/bin/python +# Shoot the bottles as fast as possible. + +from storm_games import * + +initialize_gui("Bottle Blaster") +# load sound files +bottle = pygame.mixer.Sound("sounds/bottle.ogg") + +# loop forever (until a break occurs) +while True: + # wait for an event + event = pygame.event.wait() + # if the event is about a keyboard button that have been pressed... + if event.type == pygame.KEYDOWN: + bottle.play(-1) + if event.type == pygame.KEYUP: + bottle.stop() + # and if the button is the "q" letter or the "escape" key... + if event.key == pygame.K_ESCAPE: + # ... then exit from the while loop + break + time.sleep(.001) diff --git a/pybottle/sounds/bottle.ogg b/pybottle/sounds/bottle.ogg new file mode 100644 index 0000000..d107835 Binary files /dev/null and b/pybottle/sounds/bottle.ogg differ diff --git a/pybottle/sounds/empty.ogg b/pybottle/sounds/empty.ogg new file mode 100644 index 0000000..a18f5be Binary files /dev/null and b/pybottle/sounds/empty.ogg differ diff --git a/pybottle/sounds/game-intro.ogg b/pybottle/sounds/game-intro.ogg new file mode 100644 index 0000000..dc372e9 Binary files /dev/null and b/pybottle/sounds/game-intro.ogg differ diff --git a/pybottle/sounds/glass1.ogg b/pybottle/sounds/glass1.ogg new file mode 100644 index 0000000..8a6a183 Binary files /dev/null and b/pybottle/sounds/glass1.ogg differ diff --git a/pybottle/sounds/glass2.ogg b/pybottle/sounds/glass2.ogg new file mode 100644 index 0000000..5507c91 Binary files /dev/null and b/pybottle/sounds/glass2.ogg differ diff --git a/pybottle/sounds/glass3.ogg b/pybottle/sounds/glass3.ogg new file mode 100644 index 0000000..8698ebf Binary files /dev/null and b/pybottle/sounds/glass3.ogg differ diff --git a/pybottle/sounds/gun1.ogg b/pybottle/sounds/gun1.ogg new file mode 100644 index 0000000..b9fbf3e Binary files /dev/null and b/pybottle/sounds/gun1.ogg differ diff --git a/pybottle/sounds/gun2.ogg b/pybottle/sounds/gun2.ogg new file mode 100644 index 0000000..41ca37d Binary files /dev/null and b/pybottle/sounds/gun2.ogg differ diff --git a/pybottle/sounds/gun3.ogg b/pybottle/sounds/gun3.ogg new file mode 100644 index 0000000..87de4f1 Binary files /dev/null and b/pybottle/sounds/gun3.ogg differ diff --git a/pybottle/sounds/gun4.ogg b/pybottle/sounds/gun4.ogg new file mode 100644 index 0000000..52953b3 Binary files /dev/null and b/pybottle/sounds/gun4.ogg differ diff --git a/pybottle/sounds/gun5.ogg b/pybottle/sounds/gun5.ogg new file mode 100644 index 0000000..d05e1e1 Binary files /dev/null and b/pybottle/sounds/gun5.ogg differ diff --git a/pybottle/sounds/load3.ogg b/pybottle/sounds/load3.ogg new file mode 100644 index 0000000..af7819c Binary files /dev/null and b/pybottle/sounds/load3.ogg differ diff --git a/pybottle/sounds/load4.ogg b/pybottle/sounds/load4.ogg new file mode 100644 index 0000000..af7819c Binary files /dev/null and b/pybottle/sounds/load4.ogg differ diff --git a/pybottle/sounds/load5.ogg b/pybottle/sounds/load5.ogg new file mode 100644 index 0000000..0ff00a4 Binary files /dev/null and b/pybottle/sounds/load5.ogg differ diff --git a/pybottle/storm_games.py b/pybottle/storm_games.py new file mode 100644 index 0000000..ccfe5a6 --- /dev/null +++ b/pybottle/storm_games.py @@ -0,0 +1,17 @@ +"""Standard initializations and functions shared by all games.""" + +import os +import pygame +import time + +def initialize_gui(gameTitle): + # start pygame + pygame.init() + # start the display (required by the event loop) + pygame.display.set_mode((320, 200)) + pygame.display.set_caption(gameTitle) + # Load sounds from the sound directory + soundFileNames = next(os.walk("sounds/"))[2] + for i in soundFileNames: + if i[-4:] == ".ogg": i[:-4] = pygame.mixer.Sound("sounds/" + i) +