Mercurial > pyntnclick
comparison gamelib/statehelpers.py @ 182:5cb3fbe61f75
Add genric thing with description helper class
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Wed, 25 Aug 2010 15:45:45 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
181:f98bc17f5e67 | 182:5cb3fbe61f75 |
---|---|
1 """Set of utility classes for common state things""" | |
2 | |
3 from pygame.color import Color | |
4 from pygame.colordict import THECOLORS | |
5 | |
6 from gamelib.state import Thing, Result, \ | |
7 InteractImage, InteractNoImage, InteractRectUnion, \ | |
8 InteractAnimated | |
9 from gamelib.constants import DEBUG | |
10 | |
11 | |
12 class GenericDescThing(Thing): | |
13 "Thing with an InteractiveUnionRect and a description" | |
14 | |
15 INITIAL = "description" | |
16 | |
17 def __init__(self, prefix, number, description, areas): | |
18 super(GenericDescThing, self).__init__() | |
19 self.description = description | |
20 self.name = '%s.%s' % (prefix, number) | |
21 self.interacts = { | |
22 'description' : InteractRectUnion(areas) | |
23 } | |
24 if DEBUG: | |
25 # Individual colors to make debugging easier | |
26 self._interact_hilight_color = Color(THECOLORS.keys()[number]) | |
27 | |
28 def get_description(self): | |
29 return self.description | |
30 |