first
This commit is contained in:
19
Maps/MapGenerator/DoorPosition.gd
Normal file
19
Maps/MapGenerator/DoorPosition.gd
Normal file
@@ -0,0 +1,19 @@
|
||||
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(roomGridSideLength: int,numberOfRotations: 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 (y,roomGridSideLength-x-1)
|
||||
orientation = wrapi((orientation - 1),0,4)
|
||||
|
||||
func duplicate() -> DoorPosition:
|
||||
var returnData: DoorPosition = DoorPosition.new()
|
||||
returnData.pos = pos
|
||||
returnData.orientation = orientation
|
||||
return returnData
|
||||
Reference in New Issue
Block a user