comparison gamelib/state.py @ 22:8e709824306d

Add items and things.
author Simon Cross <hodgestar+bzr@gmail.com>
date Sun, 22 Aug 2010 17:52:34 +0200
parents c9b124c2f5c6
children 1e90a3e4618e
comparison
equal deleted inserted replaced
21:4810fd976051 22:8e709824306d
22 def __init__(self): 22 def __init__(self):
23 # map of scene name -> Scene object 23 # map of scene name -> Scene object
24 self.scenes = {} 24 self.scenes = {}
25 # map of item name -> Item object 25 # map of item name -> Item object
26 self.items = {} 26 self.items = {}
27 # map of item name -> Item object in inventory
28 self.inventory = {}
27 29
28 30
29 class Scene(object): 31 class Scene(object):
30 """Base class for scenes.""" 32 """Base class for scenes."""
31 33
34 FOLDER = None
35 BACKGROUND = None
36
32 def __init__(self): 37 def __init__(self):
38 # map of thing names -> Thing objects
39 self.things = {}
40 self._background = get_image([self.FOLDER, self.BACKGROUND])
41
42 def draw_background(self, surface):
33 pass 43 pass
34 44
35 def draw_background(self, screen): 45 def draw_sprites(self, surface):
36 pass 46 pass
37 47
38 def draw_sprites(self, screen): 48 def draw(self, surface):
39 pass 49 self.draw_background(surface)
40 50 self.draw_sprites(surface)
41 def draw(self, screen):
42 self.draw_background(screen)
43 self.draw_sprites(screen)
44 51
45 52
46 class Item(object): 53 class Thing(object):
47 """Base class for items.""" 54 """Base class for things in a scene that you can interact with."""
48 55
49 def __init__(self): 56 def __init__(self):
50 pass 57 pass
51 58
59 def interact(self, item):
60 pass
61
62
63 class Item(object):
64 """Base class for inventory items."""
65
66 def __init__(self):
67 pass
68