Author Topic: Adding Emitters to FlxGroup help  (Read 1881 times)

dca

  • Member
  • **
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Adding Emitters to FlxGroup help
« on: Mon, Dec 29, 2014 »
Hello,

I'm adding Emitters to an FlxGroup and have some questions:

1) How do I make these emitters have a velocity like a FlxSprite? I want each to fall down the screen at a constant rate (particles would continually be emitted as they fall).
2) Once the emitter leaves the screen how can I reuse it at the top?

Thanks!

Wing Eraser

  • Guest
Re: Adding Emitters to FlxGroup help
« Reply #1 on: Tue, Dec 30, 2014 »
I think you mean FlxParticle. FlxEmitter is a FlxGroup that holds the particles. You can change the behavior of the particle by inheriting FlxParticle and it to your FlxEmitter.

dca

  • Member
  • **
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Adding Emitters to FlxGroup help
« Reply #2 on: Tue, Dec 30, 2014 »
I have 6 emitters I need to place at at the top of my game. They need to fall down the screen, emitting particles as they do. I've added these 6 to an FlxGroup, so I can reuse them after they fall off the screen.

Wing Eraser

  • Guest
Re: Adding Emitters to FlxGroup help
« Reply #3 on: Wed, Dec 31, 2014 »
In that case you can create a new class and inherit FlxEmitter. Copy the code from FlxObject::updateMotion() and add all the necessary fields.

Wing Eraser

  • Guest
Re: Adding Emitters to FlxGroup help
« Reply #4 on: Wed, Dec 31, 2014 »
Or even easier create a sprite and let the emitter follow it via FlxEmitter:at().
« Last Edit: Fri, Jan 2, 2015 by Wing Eraser »

dca

  • Member
  • **
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Adding Emitters to FlxGroup help
« Reply #5 on: Thu, Jan 1, 2015 »
So I would create some sprites, add them to the FlxGroup and then use FlxEmitter:at() to link them? How do I differentiate those in the FlxGroup?

Thanks!

Wing Eraser

  • Guest
Re: Adding Emitters to FlxGroup help
« Reply #6 on: Fri, Jan 2, 2015 »
You create 6 sprites at the top. Let it fall. Each emitter follows a sprite.

dca

  • Member
  • **
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Adding Emitters to FlxGroup help
« Reply #7 on: Sat, Jan 3, 2015 »
Ok, thanks! I'll give that a try.