- [NEW] Torxes implementades

This commit is contained in:
2026-03-09 12:15:58 +01:00
parent aa5f29ee24
commit f2a52570b1
10 changed files with 70 additions and 4 deletions

View File

@@ -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)