Hi there!
I don’t know if there is a default function for that, but you could do it in the update function of the scene:
let pause = false;
update(){
if(p is pressed) pause = !pause;
if(pause){
return;
}
// your code here
}
You make a global variable or scene variable to hold the pause state (let pause = false)
Then you check if the button p is pressed. If yes, then you toggle the pause value (pause = !pause).
If the game is paused, the update loop will not proceed after
if(pause){
return;
}
As for the text, you can either use the text method or use an image.