Lock a key on the keyboard when a condition occurs

Hello to all here I wish to block a key of the keyboard when I lose all my life points in order to no longer have a scale that runs but I really don’t know how to do it I looked in the doc but find nothing for my problem.

This is my code line for using the keyboard :

//For used of keyboard
keyboard = this.input.keyboard.createCursorKeys();

And this is my condition of defeat :

//Condition of defeat
if (healthPoints == 0)
text.setPosition(text.width-20,text.height+150 );
//locks the keyboard key so that the scale is not performed after the game is lost

solution find ^^

You don’t need phaser for this, just set a flag. if (healthPoints == 0 && !flag){
rest of code

or just this.input.enabled = false;

Thank’s guys :slight_smile: