Simplified things, having a module layout was making this too hard to distribute on windows

This commit is contained in:
2014-06-06 08:16:35 -07:00
parent a306f15c86
commit dbbdd9bcb4
4 changed files with 738 additions and 32 deletions

View File

@@ -2,6 +2,7 @@ import pygame
import time
import random
import os
import inspect
levelTitles = [
[
@@ -151,6 +152,7 @@ maps = [
]
class Game:
LOAD_PATH = os.path.dirname(inspect.stack()[0][1])
# Debug flags, disable these before production
DEBUG_MODE = False
DRAW_MOVES = True
@@ -201,10 +203,10 @@ class Game:
self.__marbles__ = []
pygame.display.set_caption("Fuck This Collapse")
self.__load_marbles__()
self.__sound_falling__ = pygame.mixer.Sound(os.path.join('snd', 'marblefall.wav'))
self.__sound_click__ = pygame.mixer.Sound(os.path.join('snd', 'marbleclick.wav'))
self.__sound_level__ = pygame.mixer.Sound(os.path.join('snd', 'newlevel.wav'))
pygame.mixer.music.load(os.path.join('snd', 'POL-lurking-short.wav'))
self.__sound_falling__ = pygame.mixer.Sound(self.__loadpath__(['snd', 'marblefall.wav']))
self.__sound_click__ = pygame.mixer.Sound(self.__loadpath__(['snd', 'marbleclick.wav']))
self.__sound_level__ = pygame.mixer.Sound(self.__loadpath__(['snd', 'newlevel.wav']))
pygame.mixer.music.load(self.__loadpath__(['snd', 'POL-lurking-short.wav']))
pygame.mixer.music.play(-1)
self.__curMap__ = None
@@ -225,12 +227,15 @@ class Game:
self.__mapIndex__ = 0
self.__setMap__(levelTitles[self.__mapIndex__], isTitle = True)
def __loadpath__(self, items):
return os.path.join(Game.LOAD_PATH, *items)
def __load_marbles__(self):
self.__marbles__.append(None)
self.__marbles__.append(pygame.image.load('gfx/BlueSwirl.png'))
self.__marbles__.append(pygame.image.load('gfx/MochaVolcano.png'))
self.__marbles__.append(pygame.image.load('gfx/SwirlyEyeball.png'))
self.__marbles__.append(pygame.image.load('gfx/ZebraGum.png'))
self.__marbles__.append(pygame.image.load(self.__loadpath__(['gfx', 'BlueSwirl.png'])))
self.__marbles__.append(pygame.image.load(self.__loadpath__(['gfx', 'MochaVolcano.png'])))
self.__marbles__.append(pygame.image.load(self.__loadpath__(['gfx', 'SwirlyEyeball.png'])))
self.__marbles__.append(pygame.image.load(self.__loadpath__(['gfx', 'ZebraGum.png'])))
def __setMap__(self, maparray, isTitle=False):
self.__curMap__ = []