Jump to content

Overlap Between Emitter and Group


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.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');

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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