Replaced some methods with iterator functions, added more music.
Justin Armstrong justinmeister@gmail.com
Thu, 29 May 2014 12:29:59 -0700
7 files changed,
33 insertions(+),
9 deletions(-)
M
data/components/attack.py
→
data/components/attack.py
@@ -1,9 +1,13 @@
""" Sprites for attacks. """ - +import sys import pygame as pg from .. import setup, tools + +#Python 2/3 compatibility. +if sys.version_info[0] == 2: + range = xrange class Fire(pg.sprite.Sprite): """
M
data/components/person.py
→
data/components/person.py
@@ -1,9 +1,14 @@
from __future__ import division -import math, random, copy +from itertools import izip +import math, random, copy, sys import pygame as pg from .. import setup, observer from .. import constants as c + +#Python 2/3 compatibility. +if sys.version_info[0] == 2: + range = xrange class Person(pg.sprite.Sprite): """Base class for all world characters@@ -57,7 +62,7 @@ for column in range(4):
image_list.append( self.get_image(column*32, row*32, 32, 32, sheet)) - for key, image in zip(image_keys, image_list): + for key, image in izip(image_keys, image_list): image_dict[key] = image return image_dict
M
data/constants.py
→
data/constants.py
@@ -14,7 +14,7 @@ WEAPON_SHOP = 'weapon shop'
MAGIC_SHOP = 'magic shop' HOUSE = 'house' OVERWORLD = 'overworld' -BROTHER_HOUSE = 'brother_house' +BROTHER_HOUSE = 'brotherhouse' BATTLE = 'battle' DUNGEON = 'dungeon' DUNGEON2 = 'dungeon2'
M
data/states/battle.py
→
data/states/battle.py
@@ -1,10 +1,16 @@
"""This is the state that handles battles against monsters""" -import random +import random, sys +from itertools import izip import pygame as pg from .. import tools, battlegui, observer, setup from .. components import person, attack, attackitems from .. import constants as c + + +#Python 2/3 compatibility. +if sys.version_info[0] == 2: + range = xrange class Battle(tools._State):@@ -163,7 +169,7 @@ """
pos_list = self.arrow.make_select_action_pos_list() state_list = [self.enter_select_enemy_state, self.enter_select_item_state, self.enter_select_magic_state, self.try_to_run_away] - return dict(zip(pos_list, state_list)) + return dict(izip(pos_list, state_list)) def update(self, surface, keys, current_time): """Update the battle state"""
M
data/states/levels.py
→
data/states/levels.py
@@ -5,8 +5,7 @@ differentiated by self.name and self.tmx_map.
This class inherits from the generic state class found in the tools.py module. """ - -import copy +import copy, sys import pygame as pg from .. import tools, collision from .. import constants as c@@ -15,6 +14,10 @@ from . import player_menu
from .. import tilerender from .. import setup + +#Python 2/3 compatibility. +if sys.version_info[0] == 2: + range = xrange class LevelState(tools._State):@@ -36,7 +39,9 @@ c.DUNGEON:'dungeon_theme',
c.DUNGEON2: 'dungeon_theme', c.DUNGEON3: 'dungeon_theme', c.DUNGEON4: 'dungeon_theme', - c.DUNGEON5: 'dungeon_theme'} + c.DUNGEON5: 'dungeon_theme', + c.HOUSE: 'pleasant_creek', + c.BROTHER_HOUSE: 'pleasant_creek'} if self.name in music_dict: music = music_dict[self.name]