Basic pathfinding working for crying ghosts
This commit is contained in:
@@ -3,8 +3,10 @@ using Godot;
|
||||
public partial class ProjectileBase : Area2D
|
||||
{
|
||||
[Export] public float Speed { get; set; }
|
||||
[Export] public float Lifetime { get; set; }
|
||||
|
||||
protected CharacterBase? Character;
|
||||
protected float Age { get; private set; } = 0f;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
@@ -14,6 +16,16 @@ public partial class ProjectileBase : Area2D
|
||||
}
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
Age += (float)delta;
|
||||
|
||||
if (Age >= Lifetime)
|
||||
{
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
|
||||
void OnBodyEntered(Node body)
|
||||
{
|
||||
if (body == Character)
|
||||
|
||||
Reference in New Issue
Block a user