Phaser How to call a function inside another function? So I actually have the following code that works var player var box tnt function create () this.physics.add.collider(player, box tnt, hitTnt, null, this) the function hitTnt stop the game because the player died function hitTnt (player, boxes) this.physics.pause() console.log('Game Over!') textGameOver.setText('GAME OVER') player.setTint(0xff0000) player.anims.play('default') gameOver true and I want to do something like var player var box tnt function create () this.physics.add.collider(player, box tnt, hitTnt, null, this) the function hitTnt stop the game because the player died function hitTnt (player, boxes) gameOver() other stuff here function gameOver () this.physics.pause() console.log('Game Over!') textGameOver.setText('GAME OVER') player.setTint(0xff0000) player.anims.play('default') gameOver true but I have the following error message TypeError gameOver is not a function Do you have please any ideas how to do it properly?