Ced

Members
  • Content Count

    2
  • Joined

  • Last visited

Everything posted by Ced

  1. Hello, 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(); 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 message: Do you have please any ideas how to do it properly?
  2. Hello! I am using the following code (which is a simplified snippet in order to make it more readable): 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){ this.physics.pause(); player.setTint(0xff0000); player.anims.play('default'); gameOver = true; textGameOver.setText('GAME OVER'); } Actual comportment: when the player hit the bomb: player die; end of the game Desired comportment: when the player hit the bomb: the bomb wait 3 secondes and then explode ! If the player is too close he die. But I stuggle a lot to use a timer even after reading a lot of example in the forum I am a newbie concerning Phaser so I didn't succeed to it so far. Any help would be appreciated, thank you in advance!