particles time to be handled in frames instead of seconds optionally
This commit is contained in:
parent
97de68e34b
commit
3c1746d914
@ -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 = {
|
||||
|
@ -251,7 +251,8 @@ function Player:doPhysics()
|
||||
animation_speed = 0,
|
||||
sprite_tint = hex2rgb("#fed100"),
|
||||
sprite_alpha = 0.5,
|
||||
time = 0.05,
|
||||
time = 4,
|
||||
time_unit = "frames",
|
||||
sprite_flip = {
|
||||
x = self.sprite_flip.x,
|
||||
y = self.sprite_flip.y
|
||||
@ -326,10 +327,10 @@ function Player:handleAnimation()
|
||||
elseif self.vel.y < 0 then
|
||||
self.body = self.body:change(animation.nancy.jump)
|
||||
self.mask = self.mask:change(self.mask_type.jump)
|
||||
elseif self.vel.x + self.move_x ~= 0 then
|
||||
elseif self.vel.x + self.move_x ~= 0 and not self.is_hooked then
|
||||
self.body = self.body:change(animation.nancy.run)
|
||||
self.mask = self.mask:change(self.mask_type.run)
|
||||
else
|
||||
elseif not self.is_hooked then
|
||||
self.body = self.body:change(animation.nancy.idle)
|
||||
self.mask = self.mask:change(self.mask_type.idle)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user