eloguvnah Posted January 23, 2014 Share Posted January 23, 2014 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:https://github.com/googaloo/upgrader Thanks guys, you're the best! Link to comment Share on other sites More sharing options...
Recommended Posts