how to make wrong answers of multiple choice questions end the game

can anyone please tell me that if i collide with a wrong answer in my multiple choice question, how can i make it loose one life and then when 3 lives are lost, just display end game. i have attached my image and code of game.

<!doctype html>

<meta charset="UTF-8" />

<title>The Fun Math Game</title>

<script src="dist/phaser.js"></script>

<style type="text/css">

    body {

        margin: 0;



Hey. You can make something like that

    This should be in your create() scene 

let correctAnswer = 4; // your correct answer
let lifePoints = 3; // your life points

let answerOne = this.add.sprite(0,0,"button").setInteractive(); // your answer button
answerOne.answer = 12; // button answer
    if(lifePoints <= 0)
        endGame() // your end game function if life point <= 0
    if(answerOne.answer != correctAnswer)
    //if answer incorrect decrease life points

You can also create button class if you want, or just create buttons by my example as much as you need.

End game function can be like

function endGame(){
    this.scene.start("endGameScene"); // start your end  game scene