Enemy death function
Okay! We've defined in the previous chunks that the enemy can die when the player hits on top of its head. And we have written a few lines of command to destroy the enemy object on the screen. When the enemy death state is set as true, the chunks given here sets the enemy state as dead whenever the function
EnemyDie()
is called, as shown in the following code:
--v holds the properties of the enemy character, so the dead Boolean will be set to true whenever the EnemyDie(v) function is called. function EnemyDie(v) v.dead = true EnemyDied = true end