Orientate the doors
authorNeil <neil@dip.sun.ac.za>
Sat, 5 Mar 2016 12:06:22 +0000 (14:06 +0200)
committerNeil <neil@dip.sun.ac.za>
Sat, 5 Mar 2016 12:06:22 +0000 (14:06 +0200)
koperkapel/loaders/levelloader.py

index 190319e451bbffd235678a2ddc3a6e21510f5b4c..9bb85e41ebf89fd57084d00cdd7f01522e318d23 100644 (file)
@@ -46,8 +46,14 @@ class LevelLoader(ResourceLoader):
             # Create the doors first
             doors = []
             for door in door_info['doors']:
-                # Sort out angle
-                new_door = Door(door[0], door[1], 0)
+                x, y = door
+                # is this the right check
+                if self._level.can_walk(x + 1, y, 'floor') and self._level.can_walk(x - 1, y, 'floor'):
+                    # vertical door
+                    angle = 90
+                else:
+                    angle = 0
+                new_door = Door(x, y, angle)
                 self._level.doors.append(new_door)
             # Add the keypads
             for keypad in door_info['keypads']: