I added some logic to keep track of correct guesses as well as misses. This required me to add some collision check logic to determine when the zombies reach the bottom of the screen. Phaser makes that pretty simple.

The code is getting pretty hideous. I’m adding TODOs everywhere about things that need to be cleaned up. But that’s a problem for future Seth.

Score

minigame.checkZombieAttack = function() {
  let mg = this
  this.zombies.forEach(function(zombie) {
    if(Phaser.Geom.Intersects.RectangleToRectangle(zombie.getBounds(), mg.playerHitRect)) {
      mg.damage++
      mg.damageValue.text = mg.damage
      mg.releaseVocabWord(zombie.text.text)
      zombie.text.destroy()
      zombie.destroy()
      zombie.hit = true
    }
  })
}