Added instructions screen, set volume as an attribute of each level
Justin Armstrong justinmeister@gmail.com
Sat, 31 May 2014 10:14:20 -0700
8 files changed,
117 insertions(+),
19 deletions(-)
M
data/constants.py
→
data/constants.py
@@ -21,6 +21,7 @@ DUNGEON2 = 'dungeon2'
DUNGEON3 = 'dungeon3' DUNGEON4 = 'dungeon4' DUNGEON5 = 'dungeon5' +INSTRUCTIONS = 'instructions' ##Colors
M
data/main.py
→
data/main.py
@@ -21,6 +21,7 @@ DUNGEON2 = 'dungeon2'
DUNGEON3 = 'dungeon3' DUNGEON4 = 'dungeon4' DUNGEON5 = 'dungeon5' +INSTRUCTIONS = 'instructions' def main():@@ -42,7 +43,8 @@ DUNGEON: levels.LevelState(DUNGEON, True),
DUNGEON2: levels.LevelState(DUNGEON2, True), DUNGEON3: levels.LevelState(DUNGEON3, True), DUNGEON4: levels.LevelState(DUNGEON4, True), - DUNGEON5: levels.LevelState(DUNGEON5, True) + DUNGEON5: levels.LevelState(DUNGEON5, True), + INSTRUCTIONS: main_menu.Instructions() } run_it.setup_states(state_dict, c.MAIN_MENU)
M
data/states/battle.py
→
data/states/battle.py
@@ -18,6 +18,7 @@ def __init__(self):
super(Battle, self).__init__() self.name = 'battle' self.music = setup.MUSIC['high_action'] + self.volume = 0.4 def startup(self, current_time, game_data): """Initialize state attributes"""
M
data/states/levels.py
→
data/states/levels.py
@@ -26,28 +26,29 @@ super(LevelState, self).__init__()
self.name = name self.tmx_map = setup.TMX[name] self.allow_battles = battles - self.music = self.set_music() + self.music, self.volume = self.set_music() def set_music(self): """ Set music based on name. """ - music_dict = {c.TOWN: 'town_theme', - c.OVERWORLD: 'overworld', - c.CASTLE: 'kings_theme', - c.DUNGEON:'dungeon_theme', - c.DUNGEON2: 'dungeon_theme', - c.DUNGEON3: 'dungeon_theme', - c.DUNGEON4: 'dungeon_theme', - c.DUNGEON5: 'dungeon_theme', - c.HOUSE: 'pleasant_creek', - c.BROTHER_HOUSE: 'pleasant_creek'} + music_dict = {c.TOWN: ('town_theme', .4), + c.OVERWORLD: ('overworld', .4), + c.CASTLE: ('kings_theme', .4), + c.DUNGEON: ('dungeon_theme', .4), + c.DUNGEON2: ('dungeon_theme', .4), + c.DUNGEON3: ('dungeon_theme', .4), + c.DUNGEON4: ('dungeon_theme', .4), + c.DUNGEON5: ('dungeon_theme', .4), + c.HOUSE: ('pleasant_creek', .1), + c.BROTHER_HOUSE: ('pleasant_creek', .1)} if self.name in music_dict: - music = music_dict[self.name] - return setup.MUSIC[music] + music = music_dict[self.name][0] + volume = music_dict[self.name][1] + return setup.MUSIC[music], volume else: - return None + return None, None def startup(self, current_time, game_data): """
M
data/states/shop.py
→
data/states/shop.py
@@ -19,6 +19,7 @@ super(Shop, self).__init__()
self.key = None self.sell_items = None self.music = setup.MUSIC['shop_theme'] + self.volume = 0.4 def startup(self, current_time, game_data): """Startup state"""
M
data/tools.py
→
data/tools.py
@@ -50,10 +50,8 @@ Set music for the new state.
""" if self.state.music: pg.mixer.music.load(self.state.music) - pg.mixer.music.set_volume(.4) + pg.mixer.music.set_volume(self.state.volume) pg.mixer.music.play(-1) - else: - pg.mixer.music.stop() def event_loop(self): self.events = pg.event.get()