cli-games/pybottle/storm_games.py

24 lines
624 B
Python
Raw Normal View History

2016-03-20 18:35:23 -04:00
#!/bin/python
# -*- coding: utf-8 -*-
2016-03-20 18:01:41 -04:00
"""Standard initializations and functions shared by all games."""
import os
2016-03-20 18:35:23 -04:00
from os import listdir
from os.path import isfile, join
2016-03-20 18:01:41 -04:00
import pygame
import time
2016-03-20 18:37:39 -04:00
SoundFolder = 'sounds'
2016-03-20 18:01:41 -04:00
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)
2016-03-20 18:37:39 -04:00
# Load sounds from the sound directory and creates a dict like that {'bottle': 'bottle.ogg'}
soundFiles = {f.split('.')[0]:f for f in listdir(SoundFolder) if isfile(join(SoundFolder, f))}
2016-03-20 18:35:23 -04:00
2016-03-20 18:01:41 -04:00