more stuff

This commit is contained in:
2026-05-13 19:30:02 +02:00
parent 2bb1acbece
commit 37f4ea3b4e
9 changed files with 148 additions and 16 deletions

View File

@@ -1,3 +1,4 @@
using System;
using Godot;
namespace NodeWar.Scripts;
@@ -13,8 +14,20 @@ public partial class Pip : Area2D
[Export]
public float Speed { get; set; } = 100;
private Sprite2D _gfx;
public override void _Ready()
{
_gfx = GetNode<Sprite2D>("Gfx");
_gfx.Modulate = Faction switch
{
Faction.Neutral => Colors.Gray,
Faction.Player => Colors.DarkGreen,
Faction.Computer => Colors.DarkRed,
_ => throw new ArgumentOutOfRangeException(),
};
AreaEntered += OnAreaEntered;
}
@@ -31,7 +44,7 @@ public partial class Pip : Area2D
{
if (body is Base { Faction: Faction.Computer } enteredBase)
{
enteredBase.Health -= 1;
enteredBase.HealthComponent.TakeDamage(1);
QueueFree();
}
}