Sprite action : attack = health not-1, idle = life -1

i wana make game like “Go Ninja”
he can attack = kill enemy
if he idle = he die

so sprite i already have 2 mode, attack and idle
how to implement that function??