Last stretch
This commit is contained in:
parent
466a154972
commit
68271c94ed
13 changed files with 338 additions and 99 deletions
20
scripts/entities/Teleport.cs
Normal file
20
scripts/entities/Teleport.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Teleport : Area2D
|
||||
{
|
||||
[Signal]
|
||||
public delegate void TeleportTriggeredEventHandler();
|
||||
|
||||
[Export] public Node2D To;
|
||||
|
||||
private void OnPlayerEntered(Node2D body)
|
||||
{
|
||||
if (body is not Player player)
|
||||
return;
|
||||
|
||||
player.GlobalPosition = To.GlobalPosition;
|
||||
|
||||
EmitSignal(SignalName.TeleportTriggered);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue