I'm trying to make a confetti particle system. My asset is just a white star and I'm wanting love2d to set the color per confetti star and hold that color throughout it's lifetime.
partycleSystem:setColors sets all particles to said colors/color pattern
and obviously setting the color right before drawing the particle system does the same.
I thought that setting the colors before emitting one would work but it again sets all particles to the same color.
How would I have one particle in the system stay one color?
Independent Particle Colors
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Luke100000
- Party member
- Posts: 232
- Joined: Mon Jul 22, 2013 9:17 am
- Location: Austria
- Contact:
Re: Independent Particle Colors
You could use an atlas with several colored stars, then supply the quads with particleSystem:setQuads().
Re: Independent Particle Colors
I could. I was just hoping to have the color be set by love2d. I'd prefer not to make whole new assets if I forget a color or something.Luke100000 wrote: ↑Sun Oct 27, 2019 11:50 am You could use an atlas with several colored stars, then supply the quads with particleSystem:setQuads().
- Luke100000
- Party member
- Posts: 232
- Joined: Mon Jul 22, 2013 9:17 am
- Location: Austria
- Contact:
Re: Independent Particle Colors
Sadly, so far I know there is no setColor function for particle systems. If the particle system is simple you could use a spritebatch instead.JJSax wrote: ↑Sun Oct 27, 2019 11:56 pmI could. I was just hoping to have the color be set by love2d. I'd prefer not to make whole new assets if I forget a color or something.Luke100000 wrote: ↑Sun Oct 27, 2019 11:50 am You could use an atlas with several colored stars, then supply the quads with particleSystem:setQuads().
Re: Independent Particle Colors
Ah that's a shame. Then I have two options. Would it be more efficient to create a new particle system for every color I want or new sprites?Luke100000 wrote: ↑Sun Oct 27, 2019 11:50 am Sadly, so far I know there is no setColor function for particle systems. If the particle system is simple you could use a spritebatch instead.
- Luke100000
- Party member
- Posts: 232
- Joined: Mon Jul 22, 2013 9:17 am
- Location: Austria
- Contact:
Re: Independent Particle Colors
New sprites. The most expensive part, so far I know, is the draw call itself. Also keep in mind that if you use several systems, the colors are over each other, they don't mix.JJSax wrote: ↑Mon Oct 28, 2019 5:19 pmAh that's a shame. Then I have two options. Would it be more efficient to create a new particle system for every color I want or new sprites?Luke100000 wrote: ↑Sun Oct 27, 2019 11:50 am Sadly, so far I know there is no setColor function for particle systems. If the particle system is simple you could use a spritebatch instead.
Re: Independent Particle Colors
Ok that works then. Thank you for your help!Luke100000 wrote: ↑Mon Oct 28, 2019 6:45 pm New sprites. The most expensive part, so far I know, is the draw call itself. Also keep in mind that if you use several systems, the colors are over each other, they don't mix.
Re: Independent Particle Colors
I guess I don't know how to do this. I made a sprite batch, and got the quads. but particlesystem:setQuads(quads) treats it like an animation and iterates through them based off particle lifetime. (see .love attachment)Luke100000 wrote: ↑Mon Oct 28, 2019 6:45 pmNew sprites. The most expensive part, so far I know, is the draw call itself. Also keep in mind that if you use several systems, the colors are over each other, they don't mix.JJSax wrote: ↑Mon Oct 28, 2019 5:19 pmAh that's a shame. Then I have two options. Would it be more efficient to create a new particle system for every color I want or new sprites?Luke100000 wrote: ↑Sun Oct 27, 2019 11:50 am Sadly, so far I know there is no setColor function for particle systems. If the particle system is simple you could use a sprite batch instead.
- Attachments
-
confetti.love
- (76.46 KiB) Downloaded 329 times
- kicknbritt
- Citizen
- Posts: 98
- Joined: Sat May 30, 2015 2:15 am
- Location: Chicago, IL/Anchorage,AK
Re: Independent Particle Colors
Why dont you just make a table that holds all the confetti particles, update all of them for things like movement of the confetti particles and then draw all of them using a SpriteBatch, setting thier individual colors with SpriteBatch:setColor( r, g, b, a )?
"I AM THE ARBITER!!!" *Pulls out Energy sword and kills everything*
Re: Independent Particle Colors
You mean something like creating a table of love.graphics.newParticleSystem()? Or do something outside of love2d's particle system entirely?kicknbritt wrote: ↑Wed Oct 30, 2019 9:13 am Why dont you just make a table that holds all the confetti particles, update all of them for things like movement of the confetti particles and then draw all of them using a SpriteBatch, setting thier individual colors with SpriteBatch:setColor( r, g, b, a )?
Who is online
Users browsing this forum: Amazon [Bot], Google [Bot] and 3 guests