- [FIX] Ja no peta al morir una momia
This commit is contained in:
@@ -70,7 +70,7 @@ animations = {
|
|||||||
["mummy_dead"] = {
|
["mummy_dead"] = {
|
||||||
cycle = {1},
|
cycle = {1},
|
||||||
frames = {
|
frames = {
|
||||||
{ frame={x=128,y=24,w=16,h=17}, wait=4 },
|
{ frame={x=128,y=24,w=16,h=17}, wait=50 },
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -108,16 +108,24 @@ sprites = {
|
|||||||
end
|
end
|
||||||
elseif spr.state == templates.DYING then
|
elseif spr.state == templates.DYING then
|
||||||
if spr.animation ~= "mummy_dying" then
|
if spr.animation ~= "mummy_dying" then
|
||||||
spr.animation = "mummy_dying"
|
sprites.set_animation(spr, "mummy_dying")
|
||||||
|
--spr.animation = "mummy_dying"
|
||||||
|
--spr.current_frame = 1
|
||||||
else
|
else
|
||||||
if spr.current_frame == 8 then
|
if spr.current_frame == 8 then
|
||||||
spr.animation = "mummy_dead"
|
sprites.set_animation(spr, "mummy_dead")
|
||||||
|
--spr.animation = "mummy_dead"
|
||||||
|
--spr.current_frame = 1
|
||||||
spr.state = templates.DEAD
|
spr.state = templates.DEAD
|
||||||
print("DEAD") -- [TOFIX]
|
print("DEAD") -- [TOFIX]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif spr.state == templates.DEAD then
|
elseif spr.state == templates.DEAD then
|
||||||
-- [TODO]
|
-- [TODO]
|
||||||
|
if spr.current_wait == 1 then
|
||||||
|
sprites.set_animation(spr, "mummy_walk")
|
||||||
|
spr.state = templates.ALIVE
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@@ -128,7 +136,7 @@ sprites = {
|
|||||||
|
|
||||||
local x1,y1,w1,h1 = util.aabb(spr)
|
local x1,y1,w1,h1 = util.aabb(spr)
|
||||||
for i,v in ipairs(sprites.list) do
|
for i,v in ipairs(sprites.list) do
|
||||||
if v.enemy then
|
if v.enemy and v.state ~= templates.DEAD then
|
||||||
local x2,y2,w2,h2 = util.aabb(v)
|
local x2,y2,w2,h2 = util.aabb(v)
|
||||||
if util.check_aabb_collision(x1,y1,w1,h1, x2,y2,w2,h2) then
|
if util.check_aabb_collision(x1,y1,w1,h1, x2,y2,w2,h2) then
|
||||||
if v.state == templates.ALIVE then v.state = templates.DYING end
|
if v.state == templates.ALIVE then v.state = templates.DYING end
|
||||||
@@ -291,6 +299,9 @@ sprites = {
|
|||||||
draw_sprite = function(sprite)
|
draw_sprite = function(sprite)
|
||||||
local cycle = animations[sprite.animation].cycle[sprite.current_frame]
|
local cycle = animations[sprite.animation].cycle[sprite.current_frame]
|
||||||
local frame = animations[sprite.animation].frames[cycle]
|
local frame = animations[sprite.animation].frames[cycle]
|
||||||
|
if not frame then
|
||||||
|
print(sprite.current_frame)
|
||||||
|
end
|
||||||
local reversed = frame.reversed or false
|
local reversed = frame.reversed or false
|
||||||
draw.surf(frame.frame.x, frame.frame.y, frame.frame.w, frame.frame.h, sprite.pos.x, sprite.pos.y, frame.frame.w, frame.frame.h, (not reversed) ~= (not sprite.flipped))
|
draw.surf(frame.frame.x, frame.frame.y, frame.frame.w, frame.frame.h, sprite.pos.x, sprite.pos.y, frame.frame.w, frame.frame.h, (not reversed) ~= (not sprite.flipped))
|
||||||
local x,y,w,h = util.aabb(sprite)
|
local x,y,w,h = util.aabb(sprite)
|
||||||
|
|||||||
Reference in New Issue
Block a user