diff --git a/data/animations.lua b/data/animations.lua index 3c50bb8..7ff85c7 100644 --- a/data/animations.lua +++ b/data/animations.lua @@ -120,4 +120,14 @@ animations = { { frame={x=48,y=0,w=8,h=8}, wait=100 }, } }, + ["torxa"] = { + cycle = {1,2,3,4}, + loop = true, + frames = { + { frame={x=0,y=0,w=8,h=16}, wait=2 }, + { frame={x=8,y=0,w=8,h=16}, wait=2 }, + { frame={x=16,y=0,w=8,h=16}, wait=2 }, + { frame={x=24,y=0,w=8,h=16}, wait=2 } + } + }, } \ No newline at end of file diff --git a/data/items.lua b/data/items.lua index f47e582..781fb5f 100644 --- a/data/items.lua +++ b/data/items.lua @@ -6,5 +6,9 @@ items = { [2] = { name="coin", visual = {x=0,y=40,w=8,h=8} + }, + [3] = { + name="torxa", + visual = {x=0,y=48,w=8,h=16} } } \ No newline at end of file diff --git a/data/palfade.lua b/data/palfade.lua index 2a1f8f0..debb5c6 100644 --- a/data/palfade.lua +++ b/data/palfade.lua @@ -53,6 +53,15 @@ palfade = { end, + fade_white = function(f) + for i=1,32 do + local r = math.floor(palfade.reddish[i].r + (255-palfade.reddish[i].r)*f) + local g = math.floor(palfade.reddish[i].g + (255-palfade.reddish[i].g)*f) + local b = math.floor(palfade.reddish[i].b + (255-palfade.reddish[i].b)*f) + pal.color(i-1,r,g,b) + end + end, + restore = function() pal.set(palfade.original) end diff --git a/data/rooms_background.gif b/data/rooms_background.gif index d4f53f1..c5f1acb 100644 Binary files a/data/rooms_background.gif and b/data/rooms_background.gif differ diff --git a/data/rooms_foreground.gif b/data/rooms_foreground.gif index 649bcee..e148363 100644 Binary files a/data/rooms_foreground.gif and b/data/rooms_foreground.gif differ diff --git a/data/rooms_items.gif b/data/rooms_items.gif index d3fe521..8fae6d9 100644 Binary files a/data/rooms_items.gif and b/data/rooms_items.gif differ diff --git a/data/sprites.gif b/data/sprites.gif index 6ca11e5..6b1f733 100644 Binary files a/data/sprites.gif and b/data/sprites.gif differ diff --git a/data/sprites.lua b/data/sprites.lua index bb45264..75533e2 100644 --- a/data/sprites.lua +++ b/data/sprites.lua @@ -138,7 +138,11 @@ sprites = { live = live or sprites.hero.lives-1 local light_table = {[0]=20, 30, 50, 80, 100} local red_table = {[0]=0, 0.25, 0.5, 0.75, 1} - tweening.add(1,0,0.25,easing.linear,function(value,n,finished)palfade.fade_red(value)end) + if live==4 then + tweening.add(1,0,0.25,easing.linear,function(value,n,finished)palfade.fade_white(value)end) + else + tweening.add(1,0,0.25,easing.linear,function(value,n,finished)palfade.fade_red(value)end) + end local start_light = light_table[sprites.hero.lives] local start_red = red_table[sprites.hero.lives] local end_light = light_table[live] @@ -154,7 +158,7 @@ sprites = { sprites.set_animation(sprites.hero, "mummy_dying") sprites.hero.jumping = 0 sprites.hero.cooldown = 120 - else + elseif sprites.hero.lives < 4 then sprites.hero.state = templates.DYING sprites.hero.cooldown = 60 end @@ -289,6 +293,25 @@ sprites = { end end, + update_torxa = function(spr) + if spr.state == templates.ALIVE then + if sprites.hero.lives == 4 then return end + local x1,y1,w1,h1 = util.aabb(spr) + local x2,y2,w2,h2 = util.aabb(sprites.hero) + if util.check_aabb_collision(x1,y1,w1,h1, x2,y2,w2,h2) then + sprites.hit_hero(4) + spr.state = templates.DYING + spr.timer = 0 + return + end + elseif spr.state == templates.DYING then + spr.timer = spr.timer + 1 + if spr.timer == 32 then + spr.state = templates.DYING + end + end + end, + update_brick = function(spr) if spr.timeout > 0 then spr.timeout = spr.timeout - 1 @@ -506,13 +529,15 @@ sprites = { editor.item_hovered = nil local mx,my = mouse.pos() - if editor.item_selected or editor.layer~=LAYER_ITEMS then ignore_selected = true end + if (app.update == editor.update) and (editor.item_selected or editor.layer~=LAYER_ITEMS) then ignore_selected = true end for i,v in ipairs(sprites.list) do if not ignore_selected and app.update == editor.update and mx>=v.pos.x and mx<=v.pos.x+v.size.w and my>=v.pos.y and my<=v.pos.y+v.size.h then sprites.draw_sprite_selected(v) editor.item_hovered = i else - sprites.draw_sprite(v) + if (not ignore_selected) or (not v.no_shadow) or (app.update ~= game.update) then + sprites.draw_sprite(v) + end end end sprites.draw_sprite(sprites.hero) diff --git a/data/templates.lua b/data/templates.lua index ecada9b..f4117ca 100644 --- a/data/templates.lua +++ b/data/templates.lua @@ -67,6 +67,24 @@ templates = { timeout = 10, ia = sprites.update_brick } + elseif type == "torxa" then + sprite = { + type = type, + pos = options.pos,--{ x=100, y=4*12*8+71 }, + size = { w=8,h=16 }, + bbo = { left=0, top=0, right=0, bottom=0 }, + current_frame = 1, + current_wait = 1, + flipped = options.flipped, + surf = surf.load("torxa.gif"), + animation = "torxa", + state = templates.ALIVE, + light = 30, + light_ox = 4, + light_oy = 4, + no_shadow = true, + ia = sprites.update_torxa + } else error("Template not recognized") end diff --git a/data/torxa.gif b/data/torxa.gif new file mode 100644 index 0000000..3a6300f Binary files /dev/null and b/data/torxa.gif differ