all repos — Legends-RPG @ 2de767605689fc11924fff2ea10628bb0e5b1961

A fantasy mini-RPG built with Python and Pygame.

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):
12        super(Castle, self).__init__()
13        self.name = c.CASTLE
14        self.map_width = 25
15        self.map_height = 27
16
17    def set_sprite_dialogue(self):
18        """Sets unique dialogue for each sprite"""
19        for sprite in self.sprites:
20            if sprite.location == [12, 6]:
21                sprite.dialogue = ["Please!  You must help me!",
22                                   "An evil sorceror has stolen my magic crown!",
23                                   "Without it, our town will be overun by monsters!",
24                                   "Take this money for supplies.",
25                                   "Our town's fate is in your hands!"]
26                sprite.item = self.game_data['king item']
27            else:
28                sprite.dialogue = ['Hail to the King!']