- Primera pasada de reorganització
This commit is contained in:
@@ -54,7 +54,7 @@ sprites = {
|
||||
current_frame = 1,
|
||||
current_wait = 1,
|
||||
flipped = false,
|
||||
surf = surf.load("morcus.gif"),
|
||||
surf = surf.load("gfx/morcus.gif"),
|
||||
animation = "hero_stand",
|
||||
ia = sprites.update_hero,
|
||||
state = templates.ALIVE,
|
||||
@@ -155,7 +155,7 @@ sprites = {
|
||||
|
||||
if sprites.hero.lives == 0 then
|
||||
sprites.hero.state = templates.DEAD
|
||||
sprites.hero.surf = surf.load("mummy.gif")
|
||||
sprites.hero.surf = surf.load("gfx/mummy.gif")
|
||||
sprites.set_animation(sprites.hero, "mummy_dying")
|
||||
sprites.hero.jumping = 0
|
||||
sprites.hero.cooldown = 120
|
||||
@@ -370,6 +370,42 @@ sprites = {
|
||||
end
|
||||
end,
|
||||
|
||||
update_sucubo = function(spr)
|
||||
map.surf(rooms.surf_foreground)
|
||||
if spr.state == templates.ALIVE then
|
||||
if sprites.hero.state == templates.ALIVE then
|
||||
local x1,y1,w1,h1 = util.aabb(spr) -- El meu aabb
|
||||
local x2,y2,w2,h2 = util.aabb(sprites.hero) -- el aabb del heroi
|
||||
-- Si toca al heroi...
|
||||
if util.check_aabb_collision(x1,y1,w1,h1, x2,y2,w2,h2) then
|
||||
sprites.hero_hit()
|
||||
end
|
||||
end
|
||||
|
||||
elseif spr.state == templates.DYING then
|
||||
if spr.animation ~= "mummy_dying" then
|
||||
sprites.set_animation(spr, "mummy_dying")
|
||||
spr.surf = surf.load("gfx/mummy.gif")
|
||||
else
|
||||
if spr.current_frame == 8 then
|
||||
sprites.set_animation(spr, "mummy_dead")
|
||||
spr.state = templates.DEAD
|
||||
end
|
||||
end
|
||||
elseif spr.state == templates.DEAD then
|
||||
if spr.current_wait == 1 then
|
||||
sprites.set_animation(spr, "mummy_undying")
|
||||
spr.state = templates.RESURRECTING
|
||||
end
|
||||
elseif spr.state == templates.RESURRECTING then
|
||||
if spr.current_frame == 13 then
|
||||
sprites.set_animation(spr, "sucubo_stand")
|
||||
spr.surf = surf.load("gfx/sucubo.gif")
|
||||
spr.state = templates.ALIVE
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
update_hero = function()
|
||||
|
||||
if sprites.hero.state == templates.DEAD then
|
||||
|
||||
Reference in New Issue
Block a user