diff --git a/classes/waypoint/waypoint_abstract.gd b/classes/waypoint/waypoint_abstract.gd new file mode 100644 index 0000000..bab65fd --- /dev/null +++ b/classes/waypoint/waypoint_abstract.gd @@ -0,0 +1,8 @@ +# TODO: better name +@abstract class_name Waypoint extends Resource + + +## The coordinates at which the player will spawn. +@export var spawn_coordinates: Vector2i +## The room configuration with which to enter. +@export var room_config: RoomConfig diff --git a/resources/waypoint.gd.uid b/classes/waypoint/waypoint_abstract.gd.uid similarity index 100% rename from resources/waypoint.gd.uid rename to classes/waypoint/waypoint_abstract.gd.uid diff --git a/resources/waypoint.gd b/resources/waypoint.gd deleted file mode 100644 index a1218be..0000000 --- a/resources/waypoint.gd +++ /dev/null @@ -1,8 +0,0 @@ -# TODO: better name -class_name Waypoint -extends Resource - - -#@export var from_scene: PackedScene -@export var to_scene: PackedScene -@export var spawn_coordinates: Vector2i diff --git a/resources/waypoint_local.gd b/resources/waypoint_local.gd new file mode 100644 index 0000000..e87f770 --- /dev/null +++ b/resources/waypoint_local.gd @@ -0,0 +1 @@ +class_name LocalWaypoint extends Waypoint diff --git a/resources/waypoint_local.gd.uid b/resources/waypoint_local.gd.uid new file mode 100644 index 0000000..322d23e --- /dev/null +++ b/resources/waypoint_local.gd.uid @@ -0,0 +1 @@ +uid://p0pauuvfwm7g diff --git a/resources/waypoint_remote.gd b/resources/waypoint_remote.gd new file mode 100644 index 0000000..d4d27aa --- /dev/null +++ b/resources/waypoint_remote.gd @@ -0,0 +1,5 @@ +class_name RemoteWaypoint extends Waypoint + + +## Scene to which the waypoint points. +@export var to_scene: PackedScene diff --git a/resources/waypoint_remote.gd.uid b/resources/waypoint_remote.gd.uid new file mode 100644 index 0000000..4aaf511 --- /dev/null +++ b/resources/waypoint_remote.gd.uid @@ -0,0 +1 @@ +uid://df4uqylsf7po6 diff --git a/scenes/autoload/game_director.gd b/scenes/autoload/game_director.gd index 54c7d12..46519b4 100644 --- a/scenes/autoload/game_director.gd +++ b/scenes/autoload/game_director.gd @@ -1,7 +1,7 @@ extends Node -func goto_room(previous_room: Room, waypoint: Waypoint) -> void: +func goto_room(previous_room: Room, waypoint: RemoteWaypoint, config: RoomConfig = null) -> void: print("changing rooms") # for signal @@ -17,6 +17,7 @@ func goto_room(previous_room: Room, waypoint: Waypoint) -> void: var next_room: Room = waypoint.to_scene.instantiate() next_name = next_room.name next_room.initial_spawn = waypoint.spawn_coordinates + if config: next_room.config = config get_tree().root.add_child(next_room) # notify event bus diff --git a/scenes/worlds/test_room.tscn b/scenes/worlds/test_room.tscn index ca6f690..783b298 100644 --- a/scenes/worlds/test_room.tscn +++ b/scenes/worlds/test_room.tscn @@ -6,6 +6,8 @@ [sub_resource type="Resource" id="Resource_t5fpq"] script = ExtResource("2_06s2n") +loopable = true +loop_size = Rect2i(0, 0, 320, 240) metadata/_custom_type_script = "uid://bamoq5wi0lkdy" [node name="Room" instance=ExtResource("1_tbqj1")]