-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPickableObject.py
More file actions
27 lines (23 loc) · 1.03 KB
/
PickableObject.py
File metadata and controls
27 lines (23 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from AbstractObjects import MovableObject
from Settings import Settings
from CustomExceptions import NoSuchPickableObjectTypeException
class PickableObject(MovableObject):
def __init__(self, potype='PlushTrap', **kwargs):
self.potype = potype
super().__init__(**kwargs)
def collide(self, object_picker):
if self.potype == 'HPBonus':
object_picker.hp += Settings.bonuses['HPBonus']
elif self.potype == 'SpeedBonus':
object_picker.speed += Settings.bonuses['SpeedBonus']
elif self.potype == 'AmmoBonus':
object_picker.ammo += Settings.bonuses['AmmoBonus']
elif self.potype == 'DamageTrap':
object_picker.hp -= Settings.bonuses['DamageTrap']
elif self.potype == 'SpeedTrap':
object_picker.speed -= Settings.bonuses['SpeedTrap']
elif self.potype == 'PlushTrap':
pass # screamer
else:
raise NoSuchPickableObjectTypeException(self.potype, "No such type of bonus/trap exists")
del self