b328f3965e54b3af1ed0b4997ae5bd739c246f3a
[koperkapel.git] / koperkapel / gamelib / keypad.py
1 # A doors / keypads set
2
3 import os
4 from pgzero.loaders import images
5 from ..actors.orientatedsurf import SurfActor
6 from ..constants import TILE_SIZE
7
8
9 class Keypad(SurfActor):
10
11     def __init__(self, x, y, doors):
12         self._doors = doors
13         self.game_pos = (x, y)
14         surf = images.load(os.path.join('fixtures', 'keypad'))
15         super().__init__(surf, anchor=(0, 0))
16
17     def activate(self, roaches):
18         # FIXME: Check stats
19         for door in self._doors:
20             if door.is_closed():
21                 door.open()
22             else:
23                 door.close()