create local and remote waypoint types

This commit is contained in:
yuki 2025-11-24 14:27:45 -03:00
parent c3e44a38ab
commit 0c573b933d
9 changed files with 20 additions and 9 deletions

View file

@ -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

View file

@ -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

View file

@ -0,0 +1 @@
class_name LocalWaypoint extends Waypoint

View file

@ -0,0 +1 @@
uid://p0pauuvfwm7g

View file

@ -0,0 +1,5 @@
class_name RemoteWaypoint extends Waypoint
## Scene to which the waypoint points.
@export var to_scene: PackedScene

View file

@ -0,0 +1 @@
uid://df4uqylsf7po6

View file

@ -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

View file

@ -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")]