Jump to content

Killing a grouped laser is also killing my enemy?


Recommended Posts

Hey guys, 


On collision between an enemy and a laser (within a group) I kill the laser but the enemy is also being killed. Bug or something I'm doing wrong?


Laser.prototype.update = function() {game.physics.collide(this._laserGroup, layer, laserLayerCollideHandler, null, this);game.physics.collide(this._laserGroup, jumperBot._sprite, laserJumperBotCollideHandler, null ,this);} // end updatefunction laserLayerCollideHandler(laser, layer) {laserExplode(laser, layer, this);}function laserJumperBotCollideHandler(laser, jumperBot) {laserExplode(laser, jumperBot, this);}function laserExplode(laser, target, context) {if ( laser.body.touching.right ) {context._laserEmitter.x = laser.x + (laser.body.width );context._laserEmitter.y = laser.y;context._laserEmitter.maxParticleSpeed.x = -550;context._laserEmitter.start(true, 200, null, 5);} else if ( laser.body.touching.left ) {context._laserEmitter.x = laser.x;context._laserEmitter.y = laser.y;context._laserEmitter.maxParticleSpeed.x = 550;context._laserEmitter.start(true, 200, null, 5);}laser.kill();}

My repo:



Thanks guys, you're the best!


Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...