Why does one hit hurt every enemy?

One word gave them a single, shared health bar.

Why does one hit hurt every enemy?

The problem

static means one for the whole class.

public class Enemy{    public static int Health = 100;     public void TakeDamage( int amount )    {        Health -= amount;    }}

There's one Health for the Enemy class, not one per enemy. They all write the same number.

The fix

One each, or one for all?

Without static, each enemy gets its own copy. With static, there's exactly one, shared by all of them.

instance→one per enemy
static→one, shared

The fix in code

Drop static.

public class Enemy{    public int Health = 100;     public void TakeDamage( int amount )    {        Health -= amount;    }}

Every new Enemy starts with its own 100, and a hit only touches the one you hit.

When static is right

Things there's only one of.

public class Enemy{    public int Health = 100;    public static int Spawned;     public Enemy() => Spawned++;}

A count of every enemy ever made belongs to the class, so static fits.

The rule

Each one needs its own? No static.

Each has its own
instance field
One for all
static
Shared by mistake
every enemy hurts