1bit-game-jam/scripts/entities/Teleport.cs
2023-08-19 15:23:08 +03:00

20 lines
351 B
C#

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);
}
}