Merge branch 'master' of ctpug.org.za:koperkapel
[koperkapel.git] / koperkapel / gamelib / door.py
1 # A doors / keypads set
2
3 import os
4 from pgzero.loaders import images
5 from ..actors.orientatedsurf import OrientatedSurfActor
6 from ..constants import TILE_SIZE
7
8
9 class Door(OrientatedSurfActor):
10
11     def __init__(self, x, y, angle):
12         self._closed = True
13         self._open_surf = images.load(os.path.join('fixtures', 'door_open'))
14         self._closed_surf = images.load(os.path.join('fixtures', 'door'))
15         self.game_pos = (x, y)
16         super().__init__(self._closed_surf, angle=angle, anchor=(0, 0))
17
18     def open(self):
19         self._closed = False
20         self.surf = self._open_surf
21
22     def close(self):
23         self._closed = True
24         self.surf = self._closed_surf
25
26     def is_closed(self):
27         return self._closed