X-Git-Url: https://harishankar.org/repos/?p=butaba-adventures.git;a=blobdiff_plain;f=gameobjects.py;h=190631f11c90cfdb1ebf81ad03774c5b6ba75339;hp=e64dc91c374d437ffb7ad1259621ea89990be83d;hb=6552a4a3522d0b48177a9c2ebedda92b824874f7;hpb=f4b468331db23412a3d8195e8ca2650093411697 diff --git a/gameobjects.py b/gameobjects.py index e64dc91..190631f 100644 --- a/gameobjects.py +++ b/gameobjects.py @@ -25,6 +25,21 @@ class GameObject: def use (self, otherobject): pass +class GoldCoins (GameObject): + # initialize + def __init__ (self, row, col, image, value): + text = "gold coins" + self.value = value + GameObject.__init__ (self, row, col, text, image, False) + + # no interaction with this object + def interact (self): + return True + + # use the object on Butaba - add to his gold + def use (self, butaba): + butaba.gold += self.value + class HealthPotion (GameObject): # initialize @@ -43,10 +58,10 @@ class HealthPotion (GameObject): butaba.health = butaba.MAXHEALTH class Chest (GameObject): - def __init__ (self, row, col, text, image, key_id, locked = False, items = []): + def __init__ (self, row, col, text, image, key_id, locked = False, objects = []): self.key_id = key_id self.locked = locked - self.items = items + self.objects = objects GameObject.__init__ (self, row, col, text, image, False) # no interaction with this object. Also solid so return False