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
8from ... import constants as c
9from ... import setup
10
11class Town(level_state.LevelState):
12 def __init__(self):
13 super(Town, self).__init__()
14 self.name = c.TOWN
15 self.tmx_map = setup.TMX['town']
16
17
18 def set_sprite_dialogue(self):
19 """Sets unique dialogue for each sprite"""
20 for sprite in self.sprites:
21 if sprite.location == [9, 46]:
22 sprite.dialogue = ['Welcome to our town, traveller!',
23 'Our King protects us against the evil forces of the outside world.',
24 'As long as we never leave, we have nothing to fear!']
25 elif sprite.location == [15, 41]:
26 sprite.dialogue = ['You seem tired from your travels.',
27 'Why not rest at our Inn and stay awhile?']
28 sprite.begin_auto_resting()
29 elif sprite.location == [13, 13]:
30 sprite.dialogue = ['Be careful. There are monsters surrounding our town.',
31 'Make sure to equip sufficient armour and weapons.',
32 'Spells and potions are useful too.']
33 elif sprite.location == [10, 13]:
34 sprite.dialogue = ['I have heard rumours that the King has lost something...',
35 'Perhaps you should pay him a visit.']
36 elif sprite.location == [10, 7]:
37 sprite.dialogue = ['Welcome to the castle, citizen.']
38 elif sprite.location == [13, 7]:
39 sprite.dialogue = ['Only those given special permission by the King can leave this town.',
40 'It is for our own good, as few could survive in the outside world.']
41 elif sprite.location == [18, 27]:
42 sprite.dialogue = ["Don't be frightened. I'm a friendly Demon.",
43 "My brothers and sisters, however, are not so nice.",
44 "Be careful not to run into them."]
45