Compare commits
No commits in common. "0c573b933dd0ea7b459e146c70b19eb700ffe94f" and "d851d35cac8c7b9dcd6cfdf8bd66aea2638e2e75" have entirely different histories.
0c573b933d
...
d851d35cac
11 changed files with 13 additions and 27 deletions
|
|
@ -1,8 +0,0 @@
|
|||
# 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
|
||||
8
resources/waypoint.gd
Normal file
8
resources/waypoint.gd
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# TODO: better name
|
||||
class_name Waypoint
|
||||
extends Resource
|
||||
|
||||
|
||||
#@export var from_scene: PackedScene
|
||||
@export var to_scene: PackedScene
|
||||
@export var spawn_coordinates: Vector2i
|
||||
|
|
@ -1 +0,0 @@
|
|||
class_name LocalWaypoint extends Waypoint
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://p0pauuvfwm7g
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class_name RemoteWaypoint extends Waypoint
|
||||
|
||||
|
||||
## Scene to which the waypoint points.
|
||||
@export var to_scene: PackedScene
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://df4uqylsf7po6
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
extends Node
|
||||
|
||||
|
||||
func goto_room(previous_room: Room, waypoint: RemoteWaypoint, config: RoomConfig = null) -> void:
|
||||
func goto_room(previous_room: Room, waypoint: Waypoint) -> void:
|
||||
print("changing rooms")
|
||||
|
||||
# for signal
|
||||
|
|
@ -17,7 +17,6 @@ func goto_room(previous_room: Room, waypoint: RemoteWaypoint, config: RoomConfig
|
|||
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
|
||||
|
|
|
|||
|
|
@ -59,13 +59,6 @@ func get_movement_vector() -> Vector2:
|
|||
else: return Vector2(0, signf(y_strength))
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
if wrapping:
|
||||
position.x = wrapf(position.x, x_min_wrap, x_max_wrap)
|
||||
position.y = wrapf(position.y, y_min_wrap, y_max_wrap)
|
||||
reset_physics_interpolation()
|
||||
|
||||
|
||||
func _on_loop_toggled(enabled: bool, loop_size: Rect2i) -> void:
|
||||
if enabled:
|
||||
x_min_wrap = loop_size.position.x
|
||||
|
|
|
|||
|
|
@ -13,6 +13,10 @@ func _state_physics_update(_delta: float) -> void:
|
|||
player.velocity = direction * player.max_speed * player.speed_mult
|
||||
|
||||
player.move_and_slide()
|
||||
|
||||
if player.wrapping:
|
||||
player.position.x = wrapf(player.position.x, player.x_min_wrap, player.x_max_wrap)
|
||||
player.position.y = wrapf(player.position.y, player.y_min_wrap, player.y_max_wrap)
|
||||
#endregion
|
||||
|
||||
if watch_state([WALKING]): return
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
[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")]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue