data/states/castle/castle.py (view raw)
1"""This is the castle state. Most of its functionality is inherited
2from the level_state.py module. Most of the level data is contained
3in the tilemap .txt files in this state's directory. Essentially the
4only purpose of castle.py is to assign dialogue to each sprite.
5"""
6
7from .. import level_state
8from ... import constants as c
9
10class Castle(level_state.LevelState):
11 def __init__(self, name, width, height):
12 super(Castle, self).__init__(name, width, height)
13 self.parent_level = c.TOWN
14
15 def set_sprite_dialogue(self):
16 """Sets unique dialogue for each sprite"""
17 for sprite in self.level_sprites:
18 if sprite.location == [12, 6]:
19 sprite.dialogue = ["Please! You must help me!",
20 "An evil sorceror has stolen my magic crown!",
21 "Without the crown's magic, our town will be overun by monsters!",
22 "Take this 500 gold for supplies.",
23 "Our town's fate is in your hands!"]
24 sprite.item = self.persist['king item']
25 else:
26 sprite.dialogue = ['Hail to the King!']