more stuff
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user