From 7f4bd1856869d7ae10fa8f07708fbd75c5bb7b1e Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 23 Nov 2026 12:00:20 +0100 Subject: pes --- Bullet.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Bullet.cs') diff --git a/Bullet.cs b/Bullet.cs index 9202e3a..6df2903 100644 --- a/Bullet.cs +++ b/Bullet.cs @@ -6,6 +6,7 @@ public partial class Bullet : Area2D [Export] public float Speed { get; set; } = 600.0f; [Export] public float Damage { get; set; } = 10.0f; public bool PierceEntity { get; set; } = false; + public int EntityPierceCount { get; set; } = 0; public bool PierceTerrain { get; set; } = false; public bool ricochet { get; set; } = true; public int BounceLimit { get; set; } = 5; @@ -62,11 +63,19 @@ public partial class Bullet : Area2D if (collider is IDamageable target) { target.TakeDamage(Damage); - if (!PierceEntity) + + bool canPierceEntity = PierceEntity || EntityPierceCount > 0; + if (!canPierceEntity) { QueueFree(); return; } + + if (!PierceEntity && EntityPierceCount > 0) + { + EntityPierceCount--; + } + GlobalPosition = hitPos + Direction * 0.1f; } else -- cgit v1.2.3