- [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

@@ -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 }
}
},
}

View File

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

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

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)

View File

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

BIN
data/torxa.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B