From 4679978d4ffcf2f7c424dca695b7458d271ad5b4 Mon Sep 17 00:00:00 2001 From: Willow Behar <2364126-TechRunner@users.noreply.gitlab.com> Date: Sun, 2 Jun 2024 15:24:45 -0500 Subject: [PATCH] Created Spawn Point that sets global spawn point and respawns player --- Assets/components/spawn_point.tscn | 7 +++++++ Assets/scripts/SpawnPoint.gd | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100644 Assets/components/spawn_point.tscn create mode 100644 Assets/scripts/SpawnPoint.gd diff --git a/Assets/components/spawn_point.tscn b/Assets/components/spawn_point.tscn new file mode 100644 index 0000000..523cf16 --- /dev/null +++ b/Assets/components/spawn_point.tscn @@ -0,0 +1,7 @@ +[gd_scene load_steps=2 format=3 uid="uid://cpwg1ula5qbrl"] + +[ext_resource type="Script" path="res://Assets/scripts/SpawnPoint.gd" id="1_1dk7k"] + +[node name="SpawnPoint" type="Node3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.72563, 0.394659, -9.82302) +script = ExtResource("1_1dk7k") diff --git a/Assets/scripts/SpawnPoint.gd b/Assets/scripts/SpawnPoint.gd new file mode 100644 index 0000000..8bc73ad --- /dev/null +++ b/Assets/scripts/SpawnPoint.gd @@ -0,0 +1,7 @@ +extends Node3D + + +# Called when the node enters the scene tree for the first time. +func _ready(): + GlobalSettings.SetSpawnPoint(self.global_position) + get_tree().call_group("Player", "respawn")