particles time to be handled in frames instead of seconds optionally

This commit is contained in:
lustlion
2022-03-12 18:19:07 +01:00
parent 97de68e34b
commit 3c1746d914
2 changed files with 12 additions and 5 deletions

View File

@@ -21,8 +21,14 @@ function Particle:new(x,y,particle_data)
o.sprite_flip = particle_data.sprite_flip or o.sprite_flip
o.time = particle_data.time or nil
if o.time ~= nil then o.time = o.time * game.framerate end
if o.time ~= nil then
if particle_data.time_unit ~= nil
and particle_data.time_unit == "frames" then
o.time = o.time
else
o.time = o.time * game.framerate
end
end
o.timer = 0
o.vel = {