Mercurial > rinkhals
comparison gamelib/buildings.py @ 109:48019afde338
Equipment purchasing and some toolbar tweaks.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Wed, 02 Sep 2009 18:46:10 +0000 |
parents | 437cbd856a03 |
children | 2e3a05b9594d |
comparison
equal
deleted
inserted
replaced
108:437cbd856a03 | 109:48019afde338 |
---|---|
6 import tiles | 6 import tiles |
7 | 7 |
8 class Building(Sprite): | 8 class Building(Sprite): |
9 """Base class for buildings""" | 9 """Base class for buildings""" |
10 | 10 |
11 IS_BUILDING = True | |
11 GRASSLAND = tiles.REVERSE_TILE_MAP['grassland'] | 12 GRASSLAND = tiles.REVERSE_TILE_MAP['grassland'] |
12 | 13 |
13 def __init__(self, pos): | 14 def __init__(self, pos): |
14 """Initial image, tile vid position, size and tile number for building.""" | 15 """Initial image, tile vid position, size and tile number for building.""" |
15 self.day_image = imagecache.load_image(self.IMAGE) | 16 self.day_image = imagecache.load_image(self.IMAGE) |
121 IMAGE = 'sprites/watchtower.png' | 122 IMAGE = 'sprites/watchtower.png' |
122 NAME = 'Watch Tower' | 123 NAME = 'Watch Tower' |
123 | 124 |
124 def is_building(obj): | 125 def is_building(obj): |
125 """Return true if obj is a build class.""" | 126 """Return true if obj is a build class.""" |
126 return hasattr(obj, "NAME") | 127 return getattr(obj, "IS_BUILDING", False) and hasattr(obj, "NAME") |
127 | 128 |
128 BUILDINGS = [] | 129 BUILDINGS = [] |
129 for name in dir(): | 130 for name in dir(): |
130 obj = eval(name) | 131 obj = eval(name) |
131 try: | 132 try: |