From f2a52570b1a3c89e4c286959518499f9b5ed78ed Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Mon, 9 Mar 2026 12:15:58 +0100 Subject: [PATCH] - [NEW] Torxes implementades --- data/animations.lua | 10 ++++++++++ data/items.lua | 4 ++++ data/palfade.lua | 9 +++++++++ data/rooms_background.gif | Bin 1196 -> 1196 bytes data/rooms_foreground.gif | Bin 2023 -> 2023 bytes data/rooms_items.gif | Bin 1038 -> 1042 bytes data/sprites.gif | Bin 2186 -> 2252 bytes data/sprites.lua | 33 +++++++++++++++++++++++++++++---- data/templates.lua | 18 ++++++++++++++++++ data/torxa.gif | Bin 0 -> 316 bytes 10 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 data/torxa.gif 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 d4f53f1166dc8b1a28d33f3a23c16ba7ca377a0d..c5f1acbac5bb0675f81efa999f367cf74463e471 100644 GIT binary patch delta 14 VcmZ3(xrTEC7c*n%W^U$%i~u041K|Jw delta 14 VcmZ3(xrTEC7c(QnW^U$%i~t_41B?Iw diff --git a/data/rooms_foreground.gif b/data/rooms_foreground.gif index 649bcee356f45749032f23e5d182228eba99dae0..e148363bbfadbe996dfce903c64a740aabc16151 100644 GIT binary patch delta 16 YcmaFP|D1mV7c=wkKYup!GT&kW06)bCK>z>% delta 16 XcmaFP|D1mV7c+Ax1H)!s=36WPEy)C< diff --git a/data/rooms_items.gif b/data/rooms_items.gif index d3fe521871caca9ddd5d67e27f7b6dedd0eb1784..8fae6d9c1fe84a20ac063e71c68d6db7c1d7992c 100644 GIT binary patch delta 131 zcmV-}0DS+B2$Be}3Ih-O{QN8c0001>0AK(B2=|j21CnQQ9H5Y};KPU$D_)FH0ArAW z9|LeKxw7TUm@^BeT#&P5!xkfJ9!0AK(B2=kK}1CnD39!$8f;lnWnAO;zDF#yGm zBTJr4xw2r$1uC+8MqmHP0^+C;pVY{B)u{F-dvT5ty4K`3h h+q{Dd@0)x0K;H?GTLvz$xbf%Eqf4Joy}H+c06T6TIVb=C diff --git a/data/sprites.gif b/data/sprites.gif index 6ca11e55f08b5ff0323b9d60094be23ac5b0351f..6b1f73342274299b362fce87606b20bf58eec2ba 100644 GIT binary patch delta 805 zcmV+=1KRwG5zG;=wFQ4>f&fHPQFjbuq$8&YNr6RA2MB27Bz@>Tj$Kj)nat!Sb45ea z?aVF+a6l+W>8kuqP%fIL1{x`Xd}Ja7jYvQcA`Wjd z^aV?q3QNFwm7YNV^P-B&s7;(QnoD$aKOlvaVN&81>qv)sFHp>51e($-WQH>SvFTqX zvzZBew5G7?O^1I%)R*Mcr!p1=>UTDTq0e#QLLH*1Qsu({^|VH+h6znmru&)^3>srS0R=CFP zZE{6mTiLQ!xBt2oEN7!T+v$$Lw%k1~aAPZ8@NyTh-u>=n3lQDxTGqA3JuL;=i{A7C zfV}K&FLQsl8(;0_m%fIzuX*QNUf>egwER6Vas^D@`6{@v4lZzmAKX{_-Z!=mCNOUQ zOWXvD*TR6!aDO4JVcb%&T^GgDdhln z`Nm@QGLXycT(U#sbq%S??C8K#Hntm~-B@O6K<9XAQF07?hscK!?naiH` jD@h$5J?K=cy40q&u&#H_>t6f%*T4?8u!nuf5C8x>*|?0h delta 738 zcmV<80v-L#5sDG8wFQ3=$;dYmt&xy4o$w;bNbhkhdX%&y4N14NOg1uq6P%MApo@y`_?x|s>= z)1i0hO@~6%m*mv{r!vLl=XNl}OZjYwq#+e4GSt%=Z+?dXp&=U z3t6nn)wGFKEMsBI*~%WawzGw;RXuy#0+_b7Y$fbw`$~b|?pC&K_3dv%``Y2UR=LLI zDsnYjT-_4ay8o4}E_Qi)TkYajuhso-cZ*wF?uJ#n&b@AWpBrAYns=(`Wo~%mN?y0V z*Rc4_?{R-AYgGhH)xY=!uvP{9UjpBk002e+fwQ_`tO{7c3qJ6J&kAAvDmb?Mt?Gpb zeBlZQc*C8YZh;%zU;mQW!4PineJgxo1QWQ$1$F?4rJLaqQy9b^MzM@lEaDWKn8OL4 zafx?~VboGp!9*7Fku|L37!!HFMs_g*cAR4l%a~fhQ>HSM)p}$kQyIoC9>$5itYsQU z8NwrJa+k$C<}9;0#2H3&HPrmyIk%Y1Gd3@o#k^HK_u0*P7BK-x0%kx{_|0(ktfCjq U=tevG(U6V@w4^7^$PfSkJM4I9qyPW_ 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 0000000000000000000000000000000000000000..3a6300fdbc23db9e6c74b3e331c231ec53de922b GIT binary patch literal 316 zcmZ?wbh9u|T)-f}aD)L05-f%NwNr-jDq8flf(ZrFf>IQcBNV`str7t6J5Q@ z@Ap}$nQf&r+RKkl3^_Zm;Kj`14|~fU8y1wT-Mw%3rsEst{k}i@*rCJ!e?Iy5AE+A& z6o0aCask;oAU?=W2G*Sl3VlmDrf5_y%Xz)8K<9i3?;6#4%Xhu~e_+9cb|;B$+u))T zIaV{>r*0INoxAG%nzG-s9__JeQGWS!*7=x^A(njB$AWaK{Qh^|US@9dpKtZ+hDPJ^ zK)2ek+Pvzfo?flaj_$T@^Y*^!JuUrHW~oe@v7m&Ji-}QX@zUi>mMO1Tvv5NiBNOv_ zhRs`-Z`rnE+s6HVdw1>l4+;{!Pb=8|!?>U^