Basic enemy pathing implementation

This commit is contained in:
2023-09-02 17:42:07 -07:00
parent 549cb7a325
commit 334378932c
7 changed files with 160 additions and 132 deletions

View File

@@ -1,7 +1,12 @@
using Godot;
public partial class TestEnemy : Node3D
public partial class TestEnemy : RigidBody3D
{
[Export]
private float _speed;
[Export]
private PathFollow3D _pathFollow;
public override void _Process(double delta)
{
var player = GetTree().GetFirstNodeInGroup("Player") as TestCharacter;
@@ -9,6 +14,11 @@ public partial class TestEnemy : Node3D
LookAt(player.Position);
}
public override async void _PhysicsProcess(double delta)
{
_pathFollow.Progress += _speed * (float)delta;
}
public void OnHit(Node node)
{
GD.Print("Hit detected");