Workshop › Mario-style Platformer › Step 32 of 37
A squashed enemy should stop moving and disappear: only live enemies are updated and drawn.
```js
for (const enemy of enemies) if (enemy.alive) updateEnemy(enemy)
if (enemy.alive) ctx.fillRect(enemy.x, enemy.y, enemy.w, enemy.h)
```update and in draw, if (enemy.alive) skips dead enemies.Add if (enemy.alive) in front of updateEnemy(enemy) in update and in front of the enemy's fillRect in draw.
Skills: Game states