gamnit: intro `ParticleSystem::clear`
authorAlexis Laferrière <alexis.laf@xymus.net>
Fri, 6 Oct 2017 14:46:35 +0000 (10:46 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Tue, 21 Nov 2017 19:40:26 +0000 (14:40 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/gamnit/depth/particles.nit

index bfe3392..557e694 100644 (file)
@@ -89,6 +89,16 @@ class ParticleSystem
        # Time-to-live of each particle
        private var ttls = new Array[Float]
 
+       # Clear all particles
+       fun clear
+       do
+               centers.clear
+               ots.clear
+               scales.clear
+               ttls.clear
+               total_particles = 0
+       end
+
        # Add a particle at `center` with `scale`, living for `ttl` from `time_offset`
        #
        # `time_offset` is added to the creation time, it can be used to delay the