Set spawn points
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
using Godot;
|
||||
|
||||
public partial class Level1 : Node3D
|
||||
public partial class AreaExit : Node3D
|
||||
{
|
||||
[Export]
|
||||
private int _levelIndex;
|
||||
|
||||
|
||||
private void OnExitEntered(Node3D node)
|
||||
{
|
||||
GD.Print("Exit reached");
|
||||
var main = GetTree().Root.GetNode<Main>("/root/Main");
|
||||
main.LoadNextLevel(0);
|
||||
main.LoadNextLevel(_levelIndex);
|
||||
}
|
||||
}
|
||||
5
Scripts/Level2.cs
Normal file
5
Scripts/Level2.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
using Godot;
|
||||
|
||||
public partial class Level2 : Node3D
|
||||
{
|
||||
}
|
||||
11
Scripts/SpawnPoint.cs
Normal file
11
Scripts/SpawnPoint.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Godot;
|
||||
|
||||
public partial class SpawnPoint : Marker3D
|
||||
{
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
var player = GetTree().GetFirstNodeInGroup("Player") as TestCharacter;
|
||||
player.Position = Position;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user