feat: turrents and explosions

This commit is contained in:
redglow
2026-07-21 21:53:18 +02:00
parent e7dbb9cabb
commit bc7297c6bc
18 changed files with 277 additions and 15 deletions
+15
View File
@@ -4,10 +4,25 @@ namespace GodotHostTest.Game.Projectile;
public partial class Projectile : Node2D
{
[Export] private PackedScene _explosionPackedScene = null!;
[Export] private float _speed = 100;
public override void _PhysicsProcess(double delta)
{
Position += (float)delta * _speed * Vector2.Up.Rotated(Rotation);
}
private void OnArea2DEntered(Area2D _)
{
var explosion = (GpuParticles2D)_explosionPackedScene.Instantiate();
explosion.GlobalPosition = GlobalPosition;
explosion.Emitting = true;
GetTree().CurrentScene.AddChild(explosion);
QueueFree();
}
private void OnScreenExited()
{
QueueFree();
}
}