Mercurial > rinkhals
comparison gamelib/equipment.py @ 244:7024d48c41c2
weapon layering with wing / eye
author | Adrianna Pińska <adrianna.pinska@gmail.com> |
---|---|
date | Sat, 05 Sep 2009 12:11:58 +0000 |
parents | 00d609883252 |
children | 048510e95812 |
comparison
equal
deleted
inserted
replaced
243:4f86c2616cdf | 244:7024d48c41c2 |
---|---|
6 import animations | 6 import animations |
7 | 7 |
8 class Equipment(object): | 8 class Equipment(object): |
9 IS_EQUIPMENT = True | 9 IS_EQUIPMENT = True |
10 DRAW_LAYER = 0 | 10 DRAW_LAYER = 0 |
11 UNDER_LIMB = False | |
12 UNDER_EYE = False | |
11 | 13 |
12 def __init__(self): | 14 def __init__(self): |
13 self._buy_price = self.BUY_PRICE | 15 self._buy_price = self.BUY_PRICE |
14 self._sell_price = self.SELL_PRICE | 16 self._sell_price = self.SELL_PRICE |
15 self._name = self.NAME | 17 self._name = self.NAME |
27 eq_image_file = getattr(self, eq_image_attr, None) | 29 eq_image_file = getattr(self, eq_image_attr, None) |
28 if not eq_image_file: | 30 if not eq_image_file: |
29 return None | 31 return None |
30 eq_image_left = imagecache.load_image(eq_image_file) | 32 eq_image_left = imagecache.load_image(eq_image_file) |
31 eq_image_right = imagecache.load_image(eq_image_file, ("right_facing",)) | 33 eq_image_right = imagecache.load_image(eq_image_file, ("right_facing",)) |
34 if eq_image_attr == "CHICKEN_IMAGE_FILE": | |
35 # a bit hacky; eventually the chicken should have a stack of images and layering should take care of everything | |
36 if self.UNDER_LIMB: | |
37 wing_left = imagecache.load_image("sprites/wing.png") | |
38 wing_right = imagecache.load_image("sprites/wing.png", ("right_facing",)) | |
39 eq_image_left.blit(wing_left, (0,0)) | |
40 eq_image_right.blit(wing_right, (0,0)) | |
41 if self.UNDER_EYE: | |
42 eye_left = imagecache.load_image("sprites/eye.png") | |
43 eye_right = imagecache.load_image("sprites/eye.png", ("right_facing",)) | |
44 eq_image_left.blit(eye_left, (0,0)) | |
45 eq_image_right.blit(eye_right, (0,0)) | |
32 return eq_image_left, eq_image_right, self.DRAW_LAYER | 46 return eq_image_left, eq_image_right, self.DRAW_LAYER |
33 | 47 |
34 class Weapon(Equipment): | 48 class Weapon(Equipment): |
35 IS_WEAPON = True | 49 IS_WEAPON = True |
36 DRAW_LAYER = 10 | 50 DRAW_LAYER = 10 |
51 UNDER_LIMB = True | |
37 | 52 |
38 def _get_parameter(self, parameter, wielder): | 53 def _get_parameter(self, parameter, wielder): |
39 param = getattr(self, parameter) | 54 param = getattr(self, parameter) |
40 if wielder.abode: | 55 if wielder.abode: |
41 mod_attr = 'MODIFY_%s_%s' % (self.TYPE, parameter) | 56 mod_attr = 'MODIFY_%s_%s' % (self.TYPE, parameter) |
117 BUY_PRICE = 25 | 132 BUY_PRICE = 25 |
118 SELL_PRICE = 15 | 133 SELL_PRICE = 15 |
119 | 134 |
120 STARTING_HITPOINTS = 1 | 135 STARTING_HITPOINTS = 1 |
121 | 136 |
122 CHICKEN_IMAGE_FILE = 'sprites/helmet.png' | 137 CHICKEN_IMAGE_FILE = 'sprites/equip_helmet.png' |
138 UNDER_EYE = True | |
123 | 139 |
124 class Kevlar(Armour): | 140 class Kevlar(Armour): |
125 NAME = "kevlar" | 141 NAME = "kevlar" |
126 BUY_PRICE = 100 | 142 BUY_PRICE = 100 |
127 SELL_PRICE = 75 | 143 SELL_PRICE = 75 |
128 | 144 |
129 STARTING_HITPOINTS = 2 | 145 STARTING_HITPOINTS = 2 |
130 | 146 |
131 CHICKEN_IMAGE_FILE = 'sprites/kevlar.png' | 147 CHICKEN_IMAGE_FILE = 'sprites/equip_kevlar.png' |
132 | 148 |
133 class Accoutrement(Equipment): | 149 class Accoutrement(Equipment): |
134 """Things which are not equipment, but are displayed in the same way""" | 150 """Things which are not equipment, but are displayed in the same way""" |
135 IS_EQUIPMENT = False | 151 IS_EQUIPMENT = False |
136 IS_ACCOUTREMENT = True | 152 IS_ACCOUTREMENT = True |