data/states/town/town.py (view raw)
1"""This is town state. Most of its functionality is inherited from
2the level_state.py module. Most of the level data is contained in
3the tilemap .txt files in this state's directory. Essentially the
4only purpose of town.py is to assign dialogue to each sprite
5"""
6
7from .. import level_state
8
9class Town(level_state.LevelState):
10 def __init__(self, name):
11 super(Town, self).__init__(name)
12
13 def set_sprite_dialogue(self):
14 """Sets unique dialogue for each sprite"""
15 for sprite in self.town_sprites:
16 if sprite.location == (10, 47):
17 sprite.dialogue = ['Welcome to our town, Mr. Traveller!',
18 'The King is loved by all!',
19 'You should go visit him in his castle.']
20 elif sprite.location == (16, 42):
21 sprite.dialogue = ['You seem tired, why not rest at our Inn?']
22 sprite.begin_auto_resting()
23 elif sprite.location == (14, 14):
24 sprite.dialogue = ['Be careful. There are monsters surrounding our town.',
25 'Make sure to equip sufficient armour and weapons.',
26 'Spells and potions are useful too.']
27 elif sprite.location == (11, 14):
28 sprite.dialogue = ['I have heard rumours that the King has lost something...',
29 'Perhaps you should pay him a visit.']
30 elif sprite.location == (11, 8):
31 sprite.dialogue = ['Welcome to the castle, citizen.']
32 elif sprite.location == (14, 8):
33 sprite.dialogue = ['Move along.']
34