all repos — Legends-RPG @ 852f0119dd576c36d4c94734697e77a0544c1024

A fantasy mini-RPG built with Python and Pygame.

data/states/shop.py (view raw)

 1"""
 2This class is the parent class of all shop states.
 3This includes weapon, armour, magic and potion shops.
 4It also includes the inn.  These states are scaled
 5twice as big as a level state.
 6"""
 7
 8import pygame as pg
 9from .. import tools
10from .. import tilemap as tm
11from .. components import person, textbox
12
13
14class Shop(tools._State):
15    """Basic shop state"""
16    def __init__(self, name):
17        super(Shop, self).__init__(name)
18        self.map_width = 13
19        self.map_height = 10
20
21    def startup(self, current_time, persist):
22        """Startup state"""
23        self.persist = persist
24        self.current_time = current_time
25        self.state = 'normal'
26        self.level_map = tm.make_level_map(self.name,
27                                           self.map_width,
28                                           self.map_height)
29        self.level_surface = tm.make_level_surface(self.level_map)
30        self.level_rect = self.level_surface.get_rect()
31        self.player = person.Player('right')
32        self.shop_owner = self.make_shop_owner()
33
34
35        self.dialogue_handler = textbox.DialogueHandler(self.player,
36                                                        self.shop_owner,
37                                                        self)
38
39
40    def make_shop_owner(self):
41        """Make the shop owner sprite"""
42        return None
43
44
45    def update(self, surface, keys, current_time):
46        """Update level state"""
47        pass