Files
SpaceBots/.svn/pristine/29/29a23f898e43d35000c65180fc7350c84e9b38b9.svn-base
2026-01-21 23:51:53 +01:00

15 lines
498 B
Plaintext

extends Object
class_name DoorPosition
var pos : Vector2i
var orientation : int #0 north, 1 east, 2south, 3west
enum doorOrientations {north,east,south,west}
func rotatePosRight(numberOfRotations: int, roomGridSideLength: int) -> void: #Rotates the doorPosition along the room grid by 90 degrees
for n in numberOfRotations % 4:
var x: int = pos.x
var y: int = pos.y
pos = Vector2i (roomGridSideLength-y-1,x)
orientation = wrapi(orientation + 1,0,4)
print("orientation: ", orientation)