feat: move sceneEntrance to a separate node/scene; add new dungeonScene with moving back to the previous scene; add class_name to Player;
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
extends Area2D
|
||||
|
||||
@export var next_scene: String
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
@@ -11,8 +11,9 @@ func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_body_entered(body) -> void:
|
||||
func _on_body_entered(body: Player) -> void:
|
||||
print("body entered!")
|
||||
get_tree().change_scene_to_file.call_deferred(next_scene)
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
[gd_scene format=3 uid="uid://dhvuy8co661xo"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://0a6yl260cuo3" path="res://Scenes/SceneEntrance/scene_entrance.gd" id="1_6rkgu"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bqpwv"]
|
||||
size = Vector2(19, 16)
|
||||
|
||||
[node name="SceneEntrance" type="Area2D" unique_id=1734357035]
|
||||
script = ExtResource("1_6rkgu")
|
||||
next_scene = "res://Scenes/DungeonScene/dungeon_scene.tscn"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=657294470]
|
||||
shape = SubResource("RectangleShape2D_bqpwv")
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
[connection signal="body_exited" from="." to="." method="_on_body_exited"]
|
||||
Reference in New Issue
Block a user