- [FIX] Ja no peta al morir una momia
This commit is contained in:
@@ -108,16 +108,24 @@ sprites = {
|
||||
end
|
||||
elseif spr.state == templates.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
|
||||
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
|
||||
print("DEAD") -- [TOFIX]
|
||||
end
|
||||
end
|
||||
elseif spr.state == templates.DEAD then
|
||||
-- [TODO]
|
||||
if spr.current_wait == 1 then
|
||||
sprites.set_animation(spr, "mummy_walk")
|
||||
spr.state = templates.ALIVE
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
@@ -128,7 +136,7 @@ sprites = {
|
||||
|
||||
local x1,y1,w1,h1 = util.aabb(spr)
|
||||
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)
|
||||
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
|
||||
@@ -291,6 +299,9 @@ sprites = {
|
||||
draw_sprite = function(sprite)
|
||||
local cycle = animations[sprite.animation].cycle[sprite.current_frame]
|
||||
local frame = animations[sprite.animation].frames[cycle]
|
||||
if not frame then
|
||||
print(sprite.current_frame)
|
||||
end
|
||||
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))
|
||||
local x,y,w,h = util.aabb(sprite)
|
||||
|
||||
Reference in New Issue
Block a user