I am using the following code (which is a simplified snippet in order to make it more readable):

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 = true;
    textGameOver.setText('GAME OVER');
  • Actual comportment:

    When the player hits the bomb: player die; end of the game

  • Desired comportment:

When the player hit the bomb: the bomb wait 3 seconds and then explode! If the player is too close, he dies. But I struggle a lot to use a timer even after reading a lot of examples in the forum; I am a newbie concerning Phaser so I didn't succeed to it so far.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.