war and murder

This commit is contained in:
2023-09-02 11:25:49 -07:00
parent 3b8e6b34c9
commit 7f7595b06d
8 changed files with 130 additions and 18 deletions

11
Scripts/EnemyBullet.cs Normal file
View File

@@ -0,0 +1,11 @@
using Godot;
public partial class EnemyBullet : Projectile
{
public Vector3 Target;
public override void _PhysicsProcess(double delta)
{
Translate(new Vector3(0, 0, -Speed * (float)delta));
}
}

23
Scripts/FireAtPlayer.cs Normal file
View File

@@ -0,0 +1,23 @@
using Godot;
public partial class FireAtPlayer : Timer
{
[Export]
private Node3D _enemy;
[Export]
private PackedScene _fireProjectile;
public void OnFireAtPlayer()
{
GD.Print("Fire at player");
var projectile = _fireProjectile.Instantiate<Projectile>() as EnemyBullet;
projectile.Rotation = _enemy.Rotation;
projectile.Position = _enemy.Position;
GetParent().AddChild(projectile);
}
private void OnDied()
{
Stop();
}
}

View File

@@ -66,4 +66,9 @@ public partial class TestCharacter : CharacterBody3D
await ToSignal(GetTree().CreateTimer(projectile.Cooldown), "timeout");
CanShoot = true;
}
private void OnHit(Node3D node)
{
QueueFree();
}
}