How to kill enemies by jumping on their heads?

I’m making a 2d platformer, and I can’t seem to figure out how to make it so that if i jump on an enemies head it will die.

a simple approach would be to compare your player’s Y position to the enemy’s Y position.(assuming you’re using Y as the Vertical/Up-Down axis where the higher Y is physically above the lower Y position)

So if your player has a higher Y position value vs the enemy’s Y value + Enemy’s own Height. Then your player must be above your enemy and should be kill the enemy and not take damage himself.