@@ -189,13 +189,11 @@ local function update(time_interval)
189189 return index_head , index_tail
190190end
191191
192- local function add_particles (time_interval )
192+ local function add_particles ()
193193 local center = get_center (current_corners )
194194 local center_velocity = get_center (velocity_corners )
195- center_velocity [1 ] = center_velocity [1 ]
196- / (math.max (time_interval , config .time_interval ) / 1000 )
197- * draw .BLOCK_ASPECT_RATIO
198- center_velocity [2 ] = center_velocity [2 ] / (math.max (time_interval , config .time_interval ) / 1000 )
195+ center_velocity [1 ] = center_velocity [1 ] / (config .time_interval / 1000 ) * draw .BLOCK_ASPECT_RATIO
196+ center_velocity [2 ] = center_velocity [2 ] / (config .time_interval / 1000 )
199197 local movement = {
200198 center [1 ] - previous_center [1 ],
201199 center [2 ] - previous_center [2 ],
@@ -206,7 +204,7 @@ local function add_particles(time_interval)
206204 return
207205 end
208206
209- local num_new_particles = config .particles_per_second * (time_interval / 1000 )
207+ local num_new_particles = config .particles_per_second * (config . time_interval / 1000 )
210208 + movement_magnitude * config .particles_per_length
211209 num_new_particles = math.floor (num_new_particles ) + (math.random () < (num_new_particles % 1 ) and 1 or 0 )
212210 num_new_particles = math.max (0 , math.min (num_new_particles , config .particle_max_num - # particles ))
@@ -250,19 +248,21 @@ local function update_particles(time_interval)
250248 if particle .lifetime <= 0 then
251249 table.remove (particles , i )
252250 else
253- particle .velocity [1 ] = particle .velocity [1 ] * velocity_conservation_factor
251+ particle .velocity [1 ] = (
252+ particle .velocity [1 ]
254253 + (config .particle_gravity + config .particle_random_velocity * (math.random () - 0.5 ))
255- * (time_interval / 1000 )
254+ * (config .time_interval / 1000 )
255+ ) * velocity_conservation_factor
256256 particle .velocity [2 ] = particle .velocity [2 ] * velocity_conservation_factor
257- + config .particle_random_velocity * (math.random () - 0.5 ) * (time_interval / 1000 )
257+ + config .particle_random_velocity * (math.random () - 0.5 ) * (config . time_interval / 1000 )
258258 particle .position [1 ] = particle .position [1 ]
259- + (particle .velocity [1 ] * (time_interval / 1000 )) / draw .BLOCK_ASPECT_RATIO
260- particle .position [2 ] = particle .position [2 ] + (particle .velocity [2 ] * (time_interval / 1000 ))
259+ + (particle .velocity [1 ] * (config . time_interval / 1000 )) / draw .BLOCK_ASPECT_RATIO
260+ particle .position [2 ] = particle .position [2 ] + (particle .velocity [2 ] * (config . time_interval / 1000 ))
261261 i = i + 1
262262 end
263263 end
264264
265- if config .particles_enabled then add_particles (time_interval ) end
265+ if config .particles_enabled then add_particles () end
266266end
267267
268268local function normalize (v )
0 commit comments