all repos — Legends-RPG @ 68aafd99d9f82e78e31817a43b72cdd0d7ce9900

A fantasy mini-RPG built with Python and Pygame.

Deleted unnecessary files, added initial dialogue to tmx maps
Justin Armstrong justinmeister@gmail.com
Sat, 12 Apr 2014 00:33:59 -0700
commit

68aafd99d9f82e78e31817a43b72cdd0d7ce9900

parent

a55164ece8c0aeea2d6fcc25cf11f80345134f11

M data/components/person.pydata/components/person.py

@@ -336,9 +336,9 @@

class FemaleVillager(Person): """Female Person for town""" - def __init__(self, x, y): - super(FemaleVillager, self).__init__('femalevillager', x, y, 'right') - #self.index = 1 + def __init__(self, x, y, direction='down', state='resting'): + super(FemaleVillager, self).__init__('femalevillager', x, y, direction, state) + self.index = 1 class FemaleVillager2(Person):

@@ -362,8 +362,8 @@

class OldMan(Person): """Old man villager""" - def __init__(self, x, y, filename='oldman', direction='down', state='resting'): - super(OldMan, self).__init__(filename, x, y, direction, state) + def __init__(self, x, y, direction='down', state='resting'): + super(OldMan, self).__init__('oldman', x, y, direction, state) class OldManBrother(OldMan): """Brother of Old Man"""
M data/main.pydata/main.py

@@ -1,10 +1,6 @@

from data.states.main_menu import main_menu -from data.states.town import town -from data.states.castle import castle from data.states import shop -from data.states.house import house -from data.states.overworld import overworld -from data.states.brother_house import brother_house +from data.states import levels from . import setup, tools from . import constants as c

@@ -27,17 +23,15 @@

def main(): """Add states to control here""" run_it = tools.Control(setup.ORIGINAL_CAPTION) - state_dict = {TOWN: town.Town(), - MAIN_MENU: main_menu.Menu(), - CASTLE: castle.Castle(), - HOUSE: house.House(), + state_dict = {MAIN_MENU: main_menu.Menu(), + TOWN: levels.LevelState(TOWN), + HOUSE: levels.LevelState(HOUSE), + OVERWORLD: levels.LevelState(OVERWORLD), INN: shop.Inn(), ARMOR_SHOP: shop.ArmorShop(), WEAPON_SHOP: shop.WeaponShop(), MAGIC_SHOP: shop.MagicShop(), POTION_SHOP: shop.PotionShop(), - OVERWORLD: overworld.Overworld(), - BROTHER_HOUSE: brother_house.House() } run_it.setup_states(state_dict, c.MAIN_MENU)
M data/states/brother_house/brother_house.pydata/states/brother_house/brother_house.py

@@ -6,10 +6,10 @@ only purpose of house.py is to assign dialogue to each sprite.

""" -from .. import level_state +from .. import levels from ... import constants as c -class House(level_state.LevelState): +class House(levels.LevelState): def __init__(self): super(House, self).__init__() self.name = c.BROTHER_HOUSE
M data/states/castle/castle.pydata/states/castle/castle.py

@@ -4,12 +4,12 @@ in the tilemap .txt files in this state's directory. Essentially the

only purpose of castle.py is to assign dialogue to each sprite. """ -from .. import level_state +from .. import levels from ... import constants as c -class Castle(level_state.LevelState): +class Castle(levels.LevelState): def __init__(self): - super(Castle, self).__init__() + super(Castle, self).__init__(self.name) self.name = c.CASTLE self.map_width = 25 self.map_height = 27
D data/states/house/__init__.py

@@ -1,1 +0,0 @@

-__author__ = 'justinarmstrong'
D data/states/house/blockers.txt

@@ -1,20 +0,0 @@

-0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -00000000BBBBBBBBB00000000 -000000B11B1111111B0000000 -000000B11B1111111B0000000 -000000B11B1111111B0000000 -000000B11B1111111B0000000 -000000BBBB1111111B0000000 -000000B1111111111B0000000 -000000B1111111111B0000000 -000000B1111111111B0000000 -000000B1111111111B0000000 -0000000BBBB11BBBB00000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000
D data/states/house/house.py

@@ -1,27 +0,0 @@

-"""This is the house on the lower left hand -corner of the town. Most of its functionality is inherited -from the level_state.py module. Most of the level data is contained -in the tilemap .txt files in this state's directory. Essentially the -only purpose of house.py is to assign dialogue to each sprite. -""" - - -from .. import level_state -from ... import constants as c -from ... import setup - -class House(level_state.LevelState): - def __init__(self): - super(House, self).__init__() - self.name = c.HOUSE - self.tmx_map = setup.TMX['house'] - - def set_sprite_dialogue(self): - """Sets unique dialogue for each sprite""" - for sprite in self.sprites: - if sprite.location == [14, 6]: - sprite.dialogue = ["I am very sick. cough... cough...", - "Only an ELIXIR can help me.", - "Please go to my brother and obtain one for me.", - "He lives in a house on the NorthEast shores.", - "I will be forever in your debt."]
D data/states/house/layer1.txt

@@ -1,19 +0,0 @@

-0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000BBBBBBBBBB00000000 -0000000BBBBBBBBBB00000000 -0000000BBBBBBBBBB00000000 -0000000BBBBBBBBBB00000000 -0000000BBBBBBBBBB00000000 -0000000BBBBBBBBBB00000000 -0000000BBBBBBBBBB00000000 -0000000BBBBBBBBBB00000000 -0000000BBBBQEBBBB00000000 -0000000KKKKKKKKKK00000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000
D data/states/house/layer1extra.txt

@@ -1,19 +0,0 @@

-0000000000000000000000000 -0000000G00000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000E11111111100000000 -000000011111J111100000000 -0000000111111111100000000 -0000000111111111100000000 -0000000111111111100000000 -0000000111111111100000000 -0000000111111111100000000 -0000000111111111100000000 -0000000111111111100000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000
D data/states/house/layer2.txt

@@ -1,19 +0,0 @@

-0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000111111111100000000 -0000000111111111100000000 -0000000111111111100000000 -0000000111111111100000000 -0000000111111111100000000 -0000000111111111100000000 -0000000111111111100000000 -0000000111111111100000000 -0000000111111111100000000 -00000000000NN000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000
D data/states/house/layer3.txt

@@ -1,19 +0,0 @@

-0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000111111111100000000 -0000000111111111100000000 -0000000111111111100000000 -0000000111111111100000000 -0000000111111111100000000 -0000000111111111100000000 -0000000111111111100000000 -0000000111111111100000000 -0000000111111111100000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000
D data/states/house/portals.txt

@@ -1,20 +0,0 @@

-0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -00000000000BB000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000
D data/states/house/sprite_start_pos.txt

@@ -1,19 +0,0 @@

-0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -00000000000000H0000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000
M data/states/level_state.pydata/states/levels.py

@@ -16,10 +16,10 @@ from .. import setup

class LevelState(tools._State): - def __init__(self): + def __init__(self, name): super(LevelState, self).__init__() - self.name = None - self.tmx_map = None + self.name = name + self.tmx_map = setup.TMX[name] self.map_width = None self.map_height = None

@@ -98,7 +98,9 @@

return blockers def make_sprites(self): - """Make any sprites for the level as needed""" + """ + Make any sprites for the level as needed. + """ sprites = pg.sprite.Group() for object in self.renderer.tmx_data.getObjects():

@@ -107,24 +109,25 @@ if properties['name'] == 'sprite':

left = properties['x'] * 2 top = ((properties['y']) * 2) - 32 - if properties['type'] == 'oldman': - sprites.add(person.OldMan(left, top)) - elif properties['type'] == 'bluedressgirl': - sprites.add(person.FemaleVillager(left, top)) - elif properties['type'] == 'femalewarrior': - sprites.add(person.FemaleVillager2(left, top)) - elif properties['type'] == 'devil': - print 'hi' - sprites.add(person.Devil(left, top)) + sprite_dict = {'oldman': person.OldMan(left, top), + 'bluedressgirl': person.FemaleVillager(left, top, 'right'), + 'femalewarrior': person.FemaleVillager2(left, top), + 'devil': person.Devil(left, top)} + sprite = sprite_dict[properties['type']] + self.assign_dialogue(sprite, properties) + sprites.add(sprite) return sprites - - def set_sprite_dialogue(self): - """Sets unique dialogue for each sprite""" - pass - + def assign_dialogue(self, sprite, property_dict): + """ + Assign dialogue from object property dictionaries in tmx maps to sprites. + """ + dialogue_list = [] + for i in range(int(property_dict['dialogue length'])): + dialogue_list.append(property_dict['dialogue'+str(i)]) + sprite.dialogue = dialogue_list def make_state_dict(self): """Make a dictionary of states the level can be in"""

@@ -149,9 +152,10 @@

return portal_group - def running_normally(self, surface, keys, current_time): - """Update level normally""" + """ + Update level normally. + """ self.check_for_dialogue() self.check_for_portals() self.player.update(keys, current_time)

@@ -165,7 +169,9 @@ self.draw_level(surface)

def check_for_portals(self): - """Check if the player walks into a door, requiring a level change""" + """ + Check if the player walks into a door, requiring a level change. + """ portal = pg.sprite.spritecollideany(self.player, self.portals) if portal and self.player.state == 'resting':

@@ -176,7 +182,9 @@ self.done = True

def check_for_menu(self, keys): - """Check if player hits enter to go to menu""" + """ + Check if player hits enter to go to menu. + """ if keys[pg.K_RETURN] and self.allow_input: if self.player.state == 'resting': self.state = 'menu'

@@ -187,7 +195,9 @@ self.allow_input = True

def update_game_data(self): - """Update the persistant game data dictionary""" + """ + Update the persistant game data dictionary. + """ self.game_data['last location'] = self.player.location self.game_data['last direction'] = self.player.direction self.game_data['last state'] = self.name
D data/states/overworld/__init__.py

@@ -1,1 +0,0 @@

-__author__ = 'justin'
D data/states/overworld/blockers.txt

@@ -1,38 +0,0 @@

-000000000000000000000000000000 -0BBBBBBBBB00000000000000000000 -BB00000000B0000000000000000000 -B00BBBB000B0000000000000000000 -B00B00B000B0000000000000000000 -B00B00B000BBBBBBBBBBBBBBBBBB00 -B00B00B000000000000000000000B0 -B000000000000000000000000000B0 -B000000000000000000000000000B0 -0BBBBB0000000000000000000000B0 -000000B000000000000000000000B0 -0000000BBBB000000000000BBBBB00 -0000000000B000000000000B000000 -0000000000B000000000000B000000 -0000000000B000000000000B000000 -0000000000B000000000000B000000 -0000000000B000000000000B000000 -0000000000B000000000000B000000 -0000000000B000000000000B000000 -0000000000B000000000000B000000 -0000000000B000000000000B000000 -0000000000B000000000000B000000 -0000000000B000000000000B000000 -0000000000B000000000000B000000 -0000000000B000000000000B000000 -0000000000B000000000000B000000 -00000000000B0000BBB000B0000000 -000000000000B00BBBB00B00000000 -000000000000B00BBBB00B00000000 -000000000000B00B00B00B00000000 -000000000000B00000000B00000000 -0000000000000BBBBBBBB000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000
D data/states/overworld/layer1.txt

@@ -1,37 +0,0 @@

-MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM -MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM -MMb9ab9ab4MMMMMMMMMMMMMMMMMMMM -M60000000ZMMMMMMMMMMMMMMMMMMMM -M700000004MMMMMMMMMMMMMMMMMMMM -M60000000ZMMMMMMMMMMMMMMMMMMMM -M700000000ab9ab9ab9ab9ab9abZMM -M600000000000000000000000004MM -M7NYLN000000000000000000000ZMM -MMMMMM7000000000000000000004MM -MMMMMMM6YLN000000000000NYLNZMM -MMMMMMMMMMM60000000000ZMMMMMMM -MMMMMMMMMMM700000000004MMMMMMM -MMMMMMMMMMM60000000000ZMMMMMMM -MMMMMMMMMMM700000000004MMMMMMM -MMMMMMMMMMM60000000000ZMMMMMMM -MMMMMMMMMMM700000000004MMMMMMM -MMMMMMMMMMM60000000000ZMMMMMMM -MMMMMMMMMMM700000000004MMMMMMM -MMMMMMMMMMM60000000000ZMMMMMMM -MMMMMMMMMMM700000000004MMMMMMM -MMMMMMMMMMM60000000000ZMMMMMMM -MMMMMMMMMMM700000000004MMMMMMM -MMMMMMMMMMM60000000000ZMMMMMMM -MMMMMMMMMMM700000000004MMMMMMM -MMMMMMMMMMM60000000000ZMMMMMMM -MMMMMMMMMMMML00000000YMMMMMMMM -MMMMMMMMMMMMM60000004MMMMMMMMM -MMMMMMMMMMMMM7000000ZMMMMMMMMM -MMMMMMMMMMMMM60000004MMMMMMMMM -MMMMMMMMMMMMM7LNYLNYZMMMMMMMMM -MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM -MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM -MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM -MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM -MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM -MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
D data/states/overworld/layer1extra.txt

@@ -1,37 +0,0 @@

-000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000500000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000040000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000P00000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000
D data/states/overworld/layer2.txt

@@ -1,29 +0,0 @@

-0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000
D data/states/overworld/layer3.txt

@@ -1,50 +0,0 @@

-0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000
D data/states/overworld/overworld.py

@@ -1,18 +0,0 @@

-"""This is overworld state. Most of its functionality is inherited from -the level_state.py module. Most of the level data is contained in -the tilemap.txt files in this state's directory. -""" - -from .. import level_state -from ... import constants as c -from ... import setup - -class Overworld(level_state.LevelState): - def __init__(self): - super(Overworld, self).__init__() - self.name = c.OVERWORLD - self.tmx_map = setup.TMX['overworld'] - - - -
D data/states/overworld/portals.txt

@@ -1,38 +0,0 @@

-000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -0000000000000000000000000K0000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -0000000000000000BB000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000
D data/states/overworld/sprite_start_pos.txt

@@ -1,50 +0,0 @@

-0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000010000000000000
D data/states/town/__init__.py

@@ -1,1 +0,0 @@

-__author__ = 'justinarmstrong'
D data/states/town/blockers.txt

@@ -1,51 +0,0 @@

-0000000000000000000000000 -00BBBBBBBBBBBBBBBBBBBB000 -00BBBBBBBBBBBBBBBBBBBB000 -00B0000BBBBBBBBBB0000B000 -00B000BBBBBBBBBBBB000B000 -00B000BBBBBBBBBBBB000B000 -00B000BBBBB00BBBBB000B000 -0BB000BB00000000BB000B000 -0BB00000000000000000BB000 -00BBBBBBBBB00BBBBBBBBB000 -00BBBBBBBBB00BBBBBBBBB000 -00B00000000000000000B0000 -BBBBBBBBBBB00BBBBBBBBBBBB -B00000000000000000000000B -B00000000001100000000000B -B00000000001100000000000B -B00000000001100000000000B -B00000000001100000000000B -B00000000001100000000000B -BBBB0BBB000110000BBB0BBBB -033B0B3B000110000B3B0B330 -T22B0B2B000110000B2B0B22T -0B2B0B2B000110000B2B0B2B0 -B01000100001100000100010B -0B111111111111111111111B0 -BB000000000110000000000BT -0B000000000110000000000B0 -T0B00000001GG100000000B0T -0T0B000001GGGG1000000B0T0 -T0BB0B00001GG1000000BBB0T -0BB00B00000110000000B0BT0 -0B000000000110000000000B0 -BBBBBBBBBBB11BBBBBBBBBBBB -0B000000000110000000000B0 -TB000000000110000000000BT -0B000000000110000000000B0 -T0B0B000000110000000000BT -0T0BB000000110000000000B0 -T0TB000000011000000BBBB0T -0T0BBB0000011000000B330T0 -T0T33B0000011000000B22T0T -0T02BB0000011000000B2B0T0 -T00B2B0000011000000010B0T -0TB010000001100000001B0T0 -T0B011111111111111111BT0T -0TB000000001100000000B0T0 -B0B0B00000011000000BB0T0T -B0BBB0B000011000B0B0BT0T0 -0T0B0BBB00011000BBBB00T00 -00000B0B000110000B0B00000 -0000000000000000000000000
D data/states/town/layer1.txt

@@ -1,50 +0,0 @@

-0000000000000000000000000 -00C00C00C00C00C00C0C00000 -00V000000000000000000V000 -00V0000SSSSSSSSSS0000V000 -00V0000SSSSSSSSSS0000V000 -00V0000SSSSSSSSSS0000V000 -00V0000SSSSQESSSS0000V000 -0TV00000000PA00000000V000 -00V00000000PA00000000V000 -00C00C00C00PAC00C00C00000 -00000000000RU000000000000 -00000000000BB000000000000 -MMMMMMMMMMMBBMMMMMMMMMMMM -T00000000000000000000000T -0000000000011000000000000 -T00000000001100000000000T -0000000000011000000000000 -T00000000001100000000000T -0000000000011000000000000 -T33303330001100003330333T -0333033300011000033303330 -T22202220001100002220222T -0222022200011000022202220 -T01000100001100000100010T -0T111111111111111111111T0 -T00000000001100000000000T -0T000000000110000000000T0 -T0T00000001GG100000000T0T -0T0T000001GGGG1000000T0T0 -T0T00T00001GG1000000T0T0T -0T000000000110000000000T0 -0000000000011000000000000 -MMMMMMMMMMM11MMMMMMMMMMMM -0T000000000110000000000T0 -T00000000001100000000000T -0T000000000110000000000T0 -T0T0T0000001100000000000T -0T0T0000000110000000000T0 -T0T0000000011000000333T0T -0T033300000110000003330T0 -T0T3330000011000000222T0T -0T022200000110000002220T0 -T0T2220000011000000010T0T -0T0010000001100000001T0T0 -T0T0111111111111111110T0T -0T0000000001100000000T0T0 -T0T0T000W0011000000TT0T0T -000T00T000011000T0T00T0T0 -0T000T0T000110000T0T00T00 -0000000000011000000000000
D data/states/town/layer1extra.txt

@@ -1,50 +0,0 @@

-#T000000000000000000T000# -000000000L00R0000000000#0 -#0W0000M0000000000000W#0# -0#W000000000000000000W0#0 -#0V000T00Q0O00Q0T0000V#0# -0#V000000000000000000V0#0 -#0V000000000000000000V#0# -00V000000000000000000V0#0 -#TV00000000000000000TV00# -00000000000000000000000#0 -#00000000000000000000000# -0000000000000000000000000 -@@@@@@@@@@@00@@@@@@@@@@@@ -0000000000000000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0333033300011000033303330 -0333033300011000033303330 -0222022200011000022202220 -02D202D20001100002D202D20 -0010001000011000001000100 -0011111111111111111111100 -0000000000011000000000000 -0000000000011000000000000 -00000000001$*100000000000 -0000000001$*$*10000000000 -00000000001$*100000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000033333000 -0003330000011000033333000 -0003330000011000022222000 -00022200000110000222D2000 -0002D20000011000000010000 -0000100000011000000010000 -0000111111111111111110000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000
D data/states/town/layer3.txt

@@ -1,50 +0,0 @@

-0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -0333033300000000033303330 -0333033300000000033303330 -02W202A20000000002P202M20 -0222022200000000022202220 -0010001000011000001000100 -0011111111111111111111100 -0000000000011000000000000 -0000000000011000000000000 -00000000001GG100000000000 -0000000001GGGG10000000000 -00000000001GG100000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000033333000 -0003330000011000033333000 -00033300000110000222I2000 -00022200000110000222D2000 -0002D20000011000000010000 -0000100000011000000010000 -0000111111111111111110000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000
D data/states/town/portals.txt

@@ -1,51 +0,0 @@

-0000000000000000000000000 -0000000000000000000000000 -00V000000000000000000V000 -00V000011111111110000V000 -00V000011111111110000V000 -00V000011111111110000V000 -00V00001111AA11110000V000 -00V000000000000000000V000 -00V000000000000000000V000 -0000000000000000000000000 -0000000000000000000000000 -0000000000000000000000000 -MMMMMMMMMMM00MMMMMMMMMMMM -0000000000000000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0333033300011000033303330 -0333033300011000033303330 -0222022200011000022202220 -02F202G20001100002E202D20 -0010001000011000001000100 -0011111111111111111111100 -0000000000011000000000000 -0000000000011000000000000 -0000000000111100000000000 -0000000001111110000000000 -0000000000111100000000000 -0000000000011000000000000 -0000000000011000000000000 -MMMMMMMMMMM11MMMMMMMMMMMM -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000333000 -0003330000011000000333000 -0003330000011000000222000 -00022200000110000002C2000 -0002H20000011000000010000 -0000100000011000000010000 -0000111111111111111110000 -0000000000011000000000000 -0000000W00011000000000000 -0000000000011000000000000 -0000000000011000000000000 -00000000000P1000000000000 -000000JJJJJJJJJJJJJ000000
D data/states/town/sprite_start_pos.txt

@@ -1,50 +0,0 @@

-0000000000000000000000000 -0000000000000000000000000 -00V000000000000000000V000 -00V000011111111110000V000 -00V000011111111110000V000 -00V000011111111110000V000 -00V000011111111110000V000 -00V0000000S11S0000000V000 -00V000000001100000000V000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000S11S00000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0333033300011000033303330 -0333033300011000033303330 -0222022200011000022202220 -0222022200011000022202220 -0010001000011000001000100 -0011111111111111111111100 -0000000000011000000000000 -0000000000011000000000000 -000000000011110000G000000 -0000000001111110000000000 -0000000000111100000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000000000 -0000000000011000000333000 -0003330000011000000333000 -0003330000011000000222000 -000222000001100E000222000 -0002220000011000000010000 -0000100000011000000010000 -0000111111111111111110000 -0000000000011000000000000 -00000000DF011000000000000 -00000000D0011000000000000 -0000000000011000000000000 -0000000000011000000000000
D data/states/town/town.py

@@ -1,45 +0,0 @@

-"""This is town state. Most of its functionality is inherited from -the level_state.py module. Most of the level data is contained in -the tilemap .txt files in this state's directory. Essentially the -only purpose of town.py is to assign dialogue to each sprite -""" - -from .. import level_state -from ... import constants as c -from ... import setup - -class Town(level_state.LevelState): - def __init__(self): - super(Town, self).__init__() - self.name = c.TOWN - self.tmx_map = setup.TMX['town'] - - - def set_sprite_dialogue(self): - """Sets unique dialogue for each sprite""" - for sprite in self.sprites: - if sprite.location == [9, 46]: - sprite.dialogue = ['Welcome to our town, traveller!', - 'Our King protects us against the evil forces of the outside world.', - 'As long as we never leave, we have nothing to fear!'] - elif sprite.location == [15, 41]: - sprite.dialogue = ['You seem tired from your travels.', - 'Why not rest at our Inn and stay awhile?'] - sprite.begin_auto_resting() - elif sprite.location == [13, 13]: - sprite.dialogue = ['Be careful. There are monsters surrounding our town.', - 'Make sure to equip sufficient armour and weapons.', - 'Spells and potions are useful too.'] - elif sprite.location == [10, 13]: - sprite.dialogue = ['I have heard rumours that the King has lost something...', - 'Perhaps you should pay him a visit.'] - elif sprite.location == [10, 7]: - sprite.dialogue = ['Welcome to the castle, citizen.'] - elif sprite.location == [13, 7]: - sprite.dialogue = ['Only those given special permission by the King can leave this town.', - 'It is for our own good, as few could survive in the outside world.'] - elif sprite.location == [18, 27]: - sprite.dialogue = ["Don't be frightened. I'm a friendly Demon.", - "My brothers and sisters, however, are not so nice.", - "Be careful not to run into them."] -
M resources/tmx/house.tmxresources/tmx/house.tmx

@@ -28,7 +28,16 @@ eJztzckNgEAMBMHBJhGORDgSgSXxXQiElojBvNxSfWekLPuqJjXceCzmo3PJ4Og95mNgd8SEOehjYXfFhj3o42D3RMEV9JFl2T+9ywQG6w==

</data> </layer> <objectgroup name="Object Layer 1" width="25" height="19"> - <object name="sprite" type="oldman" gid="115" x="240" y="128"/> + <object name="sprite" type="oldman" gid="115" x="240" y="128"> + <properties> + <property name="dialogue length" value="5"/> + <property name="dialogue0" value="I am very sick. cough... cough..."/> + <property name="dialogue1" value="Only an ELIXIR can help me."/> + <property name="dialogue2" value="Please go to my brother and obtain one for me."/> + <property name="dialogue3" value="He lives in a house on the NorthEast shores."/> + <property name="dialogue4" value="I will be forever in your debt."/> + </properties> + </object> <object name="start point" gid="123" x="176" y="224"> <properties> <property name="state" value="town"/>

@@ -37,5 +46,60 @@ </object>

<object name="portal" type="town" gid="139" x="192" y="240"/> <object name="portal" type="town" gid="139" x="176" y="240"/> <object name="portal" type="town" gid="139" x="160" y="240"/> + <object name="blocker" gid="120" x="144" y="240"/> + <object name="blocker" gid="120" x="128" y="240"/> + <object name="blocker" gid="120" x="112" y="240"/> + <object name="blocker" gid="120" x="96" y="240"/> + <object name="blocker" gid="120" x="80" y="224"/> + <object name="blocker" gid="120" x="80" y="192"/> + <object name="blocker" gid="120" x="80" y="208"/> + <object name="blocker" gid="120" x="80" y="176"/> + <object name="blocker" gid="120" x="80" y="160"/> + <object name="blocker" gid="120" x="80" y="128"/> + <object name="blocker" gid="120" x="80" y="128"/> + <object name="blocker" gid="120" x="80" y="144"/> + <object name="blocker" gid="120" x="80" y="112"/> + <object name="blocker" gid="120" x="80" y="96"/> + <object name="blocker" gid="120" x="96" y="96"/> + <object name="blocker" gid="120" x="112" y="96"/> + <object name="blocker" gid="120" x="112" y="112"/> + <object name="blocker" gid="120" x="112" y="128"/> + <object name="blocker" gid="120" x="112" y="128"/> + <object name="blocker" gid="120" x="112" y="144"/> + <object name="blocker" gid="120" x="112" y="144"/> + <object name="blocker" gid="120" x="112" y="160"/> + <object name="blocker" gid="120" x="128" y="160"/> + <object name="blocker" gid="120" x="128" y="128"/> + <object name="blocker" gid="120" x="128" y="144"/> + <object name="blocker" gid="120" x="128" y="96"/> + <object name="blocker" gid="120" x="128" y="112"/> + <object name="blocker" gid="120" x="160" y="80"/> + <object name="blocker" gid="120" x="144" y="80"/> + <object name="blocker" gid="120" x="176" y="80"/> + <object name="blocker" gid="120" x="192" y="80"/> + <object name="blocker" gid="120" x="224" y="80"/> + <object name="blocker" gid="120" x="208" y="80"/> + <object name="blocker" gid="120" x="256" y="80"/> + <object name="blocker" gid="120" x="240" y="80"/> + <object name="blocker" gid="120" x="272" y="80"/> + <object name="blocker" gid="120" x="288" y="80"/> + <object name="blocker" gid="120" x="288" y="80"/> + <object name="blocker" gid="120" x="288" y="96"/> + <object name="blocker" gid="120" x="288" y="112"/> + <object name="blocker" gid="120" x="288" y="128"/> + <object name="blocker" gid="120" x="288" y="128"/> + <object name="blocker" gid="120" x="288" y="144"/> + <object name="blocker" gid="120" x="288" y="144"/> + <object name="blocker" gid="120" x="288" y="160"/> + <object name="blocker" gid="120" x="288" y="176"/> + <object name="blocker" gid="120" x="288" y="192"/> + <object name="blocker" gid="120" x="288" y="192"/> + <object name="blocker" gid="120" x="288" y="208"/> + <object name="blocker" gid="120" x="288" y="224"/> + <object name="blocker" gid="120" x="272" y="240"/> + <object name="blocker" gid="120" x="256" y="240"/> + <object name="blocker" gid="120" x="240" y="240"/> + <object name="blocker" gid="120" x="224" y="240"/> + <object name="blocker" gid="120" x="208" y="240"/> </objectgroup> </map>
M resources/tmx/town.tmxresources/tmx/town.tmx

@@ -238,8 +238,28 @@ <properties>

<property name="state" value="weapon shop"/> </properties> </object> - <object name="sprite" type="bluedressgirl" gid="124" x="144" y="768"/> - <object name="sprite" type="femalewarrior" gid="124" x="240" y="640"/> - <object name="sprite" type="devil" gid="124" x="288" y="464"/> + <object name="sprite" type="bluedressgirl" gid="124" x="144" y="768"> + <properties> + <property name="dialogue length" value="3"/> + <property name="dialogue0" value="Welcome to our town, traveller!"/> + <property name="dialogue1" value="Our King protects us against the evil forces of the outside world."/> + <property name="dialogue2" value="As long as we never leave, we have nothing to fear!"/> + </properties> + </object> + <object name="sprite" type="femalewarrior" gid="124" x="240" y="640"> + <properties> + <property name="dialogue length" value="2"/> + <property name="dialogue0" value="You seem tired from your travels."/> + <property name="dialogue1" value="Why not rest at our Inn and stay awhile?"/> + </properties> + </object> + <object name="sprite" type="devil" gid="124" x="288" y="464"> + <properties> + <property name="dialogue length" value="3"/> + <property name="dialogue0" value="Don't be frightened. I'm a friendly Demon."/> + <property name="dialogue1" value="My brothers and sisters, however, are not so nice."/> + <property name="dialogue2" value="Be careful not to run into them."/> + </properties> + </object> </objectgroup> </map>