Jump to content

Smelly sprites, SpriteBatches, Emitters, and createMultiple()


GreatBigBore
 Share

Recommended Posts

I'm looking for a way to create smelly sprites. That is, each one of them emits lots of odor, in the form of bunches of tiny sprites. I've tried using an emitter to create the main sprites, then attaching an emitter to each sprite to emit the smell. This starts to weigh on the CPU pretty quickly, even with just a handful of emitters going. I see the doc for SpriteBatch, which says it's good for creating a bunch of identical sprites, but isn't that what emitters do anyway? I can't figure out how to use SpriteBatch in conjunction with an emitter. I notice that Emitter has createMultiple(), which looks suspiciously similar to makeParticles(), but it doesn't seem to work the same.

Would a SpriteBatch be different from just maintaining my own array of sprites and re-using them whenever possible?

My basic goal is to have a lot of sprites, each of which produces a lot more sprites. Should I do this with emitters, or SpriteBatches, or both? Thanks for any advice.

Link to comment
Share on other sites

It sounds like what you need is a particle library. That is really what particles are in Phaser: a ton of tiny sprites. There is a commercial plugin for Phaser called Particle Storm that makes some really nice particle effects with good performance. It could be considered a bit on the pricier side at $32, but I thought it was more than worth the price versus writing something like it myself. 

Link to comment
Share on other sites

12 hours ago, Jackolantern said:

There is a commercial plugin for Phaser called Particle Storm that makes some really nice particle effects with good performance.

Thanks, yes, I bought the library a while back, when I first started this project. The problem is that it doesn't have physics bodies. I need my guys to actually smell bad, not just look like they smell bad. I've found that home-made emitters are less of a drain on the CPU, so I'm going in that direction for now. Thanks.

Link to comment
Share on other sites

3 hours ago, GreatBigBore said:

Thanks, yes, I bought the library a while back, when I first started this project. The problem is that it doesn't have physics bodies. I need my guys to actually smell bad, not just look like they smell bad. I've found that home-made emitters are less of a drain on the CPU, so I'm going in that direction for now. Thanks.

Glad you got it sorted. But out of curiosity, what is it you are looking to do with your particles having physics? Is it so that they will fill up a room, collect in an area and generally collide? It seems maybe that is the case since you talk about them being "stinky" lol. I am just asking because it sounds interesting. 

Link to comment
Share on other sites

3 hours ago, Jackolantern said:

I am just asking because it sounds interesting. 

My characters need to be able to find their food. They can smell things a certain distance away -- each guy is attached to a big, circular (invisible) sprite that represents his smell range. I need to detect the overlap between the smell particles and their sensor, so they know the food is there, how much is there, how far away, what direction, that sort of thing.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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