Jump to content

Overlap Between Emitter and Group


Titus
 Share

Recommended Posts

Hi guys,

just a quick question. I'm trying to detect overlap between emitter particles and a group like so: 

	    

create: function() {
        this.emitter = this.game.add.emitter(0, 0, 1000);
		this.emitter.enableBody = true;
		this.emitter.makeParticles('whiteParticle'); 
		this.emitter.minParticleSpeed.setTo(100);
        this.emitter.maxParticleSpeed.setTo(800);
        this.emitter.gravity = 50;
        this.emitter.maxParticleScale = 3;
        this.emitter.minParticleScale = 0.1;
        this.emitter.setYSpeed(-150, 150);
        this.emitter.flow(1500, 100, 100, -1, false); //lifespan, frequency, quantity, total, immediate
        this.emitter.checkWorldBounds = true;
    	this.emitter.outOfBoundsKill = true;

        this.fire = this.game.add.group();  
        this.fire.enableBody = true;
        this.fire3 = this.game.add.sprite(1423, 500, 'fireL3');
        this.fire2 = this.game.add.sprite(1423, 500, 'fireL2');
        this.fire1 = this.game.add.sprite(1423, 500, 'fireL1');
        this.fire.add(this.fire3);
        this.fire.add(this.fire2);
        this.fire.add(this.fire1);
}, 

update: function(){
      this.game.physics.arcade.overlap(this.emitter, this.fire, this.damageFire, null, this);  
}  

damageFire: function(){
        console.log('fire damaged!');
},     

I can get this to work fine if I check for overlap between 2 sprites/groups, but I cannot get it to work for the emitter. Could anyone point me in the right direction? Thanks

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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