offset particle drawing order so that recently emitted particles are always drawn on top of the older ones

This commit is contained in:
romulox_x 2014-10-12 20:20:56 -07:00
parent 948fd83cdd
commit 299bccdee9

View File

@ -507,7 +507,13 @@ void Particles2D::_notification(int p_what) {
}
for(int i=0;i<particle_count;i++) {
int start_particle = (int)(time * (float)particle_count / lifetime);
for (int id=0;id<particle_count;++id) {
int i = start_particle + id;
if (i >= particle_count) {
i -= particle_count;
}
Particle &p=pdata[i];
if (!p.active)