Issues

Issue #505 resolved

ParticleSystem suggestions

hahawoo
created an issue

It might be cool if all the setters had getters, and all the getters had setters. (e.g. setX, getRotation etc.)

Also, perhaps love.graphics.newParticleSystem could have a default buffer size. I'm not certain what the default value should be though. Maybe 1000?

I'm not sure whether this is a good idea, but perhaps setGravity could be renamed setVerticalVelocity, and joined by setHorizontalVelocity.

And I was wondering whether setSprite would be better named setImage. Perhaps "sprite" is the correct term, but it seems slightly incongruous with SpriteBatch:setImage.

Edit: Maybe isPaused and isStopped methods would be useful too? I'm not really sure about use cases outside of a particle system demo/editor.

Another edit:

  • What if setEmissionRate and setLifetime had (min, max) arguments like some other ParticleSystem methods? They're a bit different in that they're about the emitter and not the particles, and also setLifetime has the special case of -1 meaning "emit forever".
  • Would setColorVariation be possible/awesome?
  • setLifetime and setParticleLife seem to be named kind of inconsistently.

And maybe if count was named getNumParticles or something it would be more descriptive and consistent? Names not starting with is/get/set generally seem to be "actions" performed on an object, like play or update, and getNum* names are consistent with love.audio.getNumSources and things in the love.joystick module, although love.physics seems to use love.physics.get*Count.

Comments (11)

  1. Robert mccartney

    Tempted to do this. I suppose I'll have to check and see how many getters are missing setters and vice versa. Also I agree that setColorVariation would be awesome. And it's probably possible.

  2. Cory Swauger

    Any word on whether we could do this or not? My proposal was marked as a duplicate of this one but that was months ago, and we have no reply on this. Please?

  3. Alex Szpakowski

    Some more getters would be useful, but... many of the missing ones frankly would probably waste space and clutter the API and wiki rather than be of any use at all. Where do I draw the line?

  4. Cory Swauger

    At the moment, there are currently 21 methods to set particle system properties but only 7 methods for retrieving them.

    That means, instead of calling a getter method on the missing 16 attributes, we have to store, track, and modify those attributes in a table rather than just simply getting whatever state they are currently in.

    Just about every other setter in all of LOVE has its own getter, if nothing else this is consistent with the rest of the API.

  5. hahawoo reporter

    Regarding the usefulness of getters, I think they'd be useful for a particle system editor.

    But the reason why I think it's worth the API clutter is because it's consistent, which is great because then you don't have to wonder which setters have getters and which internal state you have to keep track of yourself, because (except for special cases due to technical reasons) all the getters have setters!

    It could be said to be API/wiki clutter, but there's less mental clutter! :D

    Perhaps this is a naive philosophy though?

    I'd assume setColorVariation would vary where the colours are along the gradient. Perhaps this is tricky/pointless though. Just throwing it out there!

  6. Log in to comment