Jump to content

Search the Community

Showing results for tags 'timer event'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 2 results

  1. I am trying to create a bomb that only goes off after the player has collides with it but delays for a number of seconds. Currently it goes off immediately I have my collision as below game.physics.arcade.collide(this.player, this.tnts, this.tntCollision, null, this); and the collison handler as below tntCollision: function (player, tnt) { if (player.body.touching.right){ player.body.velocity.x = -200; } else if (player.body.touching.down) { tnt.kill(); var explosionGroup = "explosionSmallGroup"; var explosion = this[explosionGroup].getFirstExists(false); explosion.reset(tnt.x, tnt.y); explosion.animations.play('explode', 30, false, true); } else if (player.body.touching.left) { player.body.velocity.x = 200; } }
  2. Hi, I'm trying to recreate Bomberman as a fun project when I have nothing to do at work. As for now I'm testing out the creation and destroying of bombs using a timer event. See code: update: function () { this.game.physics.arcade.collide(this.player, this.walls); if (this.cursor.left.isDown) { this.player.body.velocity.x = -150; } else if (this.cursor.right.isDown) { this.player.body.velocity.x = 150; } else { // Stop the player this.player.body.velocity.x = 0; } if (this.cursor.up.isDown) { this.player.body.velocity.y = -150; } else if (this.cursor.down.isDown) { this.player.body.velocity.y = 150; } else { // Stop the player this.player.body.velocity.y = 0; } this.space.onDown.add(function() { var bomb = this.game.add.sprite(this.player.x, this.player.y, 'bomb'); this.game.time.events.add(Phaser.Timer.SECOND * 3, function(){ bomb.kill(); }, this); }, this); },So as a test I try to place a bomb using the "space" key and destroy it after 3 seconds. Now as for the first few bombs no lag is showing. After about 20 bombs being destoryed and placing one, the player stays for about half a second and then moves on. I'm no expert in threads nor events, but I wonder if the created events keep running in the background (even after it killed the bomb object). How come?
×
×
  • Create New...