X-Git-Url: https://git.ctpug.org.za/?p=koperkapel.git;a=blobdiff_plain;f=koperkapel%2Fgamelib%2Fkeypad.py;h=bf9e084e0d23319d841a27088656f72b34ff4cb9;hp=b328f3965e54b3af1ed0b4997ae5bd739c246f3a;hb=92591cd60f6346d318735b9a1adf778b57177917;hpb=f1955c8e7345b183c12682caa9daac0741d52af1 diff --git a/koperkapel/gamelib/keypad.py b/koperkapel/gamelib/keypad.py index b328f39..bf9e084 100644 --- a/koperkapel/gamelib/keypad.py +++ b/koperkapel/gamelib/keypad.py @@ -8,16 +8,19 @@ from ..constants import TILE_SIZE class Keypad(SurfActor): - def __init__(self, x, y, doors): + def __init__(self, x, y, doors, required_smart=0): self._doors = doors self.game_pos = (x, y) + self.required_smart = required_smart surf = images.load(os.path.join('fixtures', 'keypad')) super().__init__(surf, anchor=(0, 0)) - def activate(self, roaches): - # FIXME: Check stats - for door in self._doors: - if door.is_closed(): - door.open() - else: - door.close() + def activate(self, smart): + if smart >= self.required_smart: + for door in self._doors: + if door.is_closed(): + door.open() + else: + door.close() + else: + print("You are not smart enough for this keypad.")