From a86011ba37a07c2f1cb292a31f9027384d28e33a Mon Sep 17 00:00:00 2001 From: "Raimon @ quifisraimon" Date: Wed, 30 Sep 2026 13:59:41 +0200 Subject: [PATCH] =?UTF-8?q?-=20[NEW]=20Proves=20de=20particles=20de=20pols?= =?UTF-8?q?...=20no=20me=20conven=C3=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/gfx/morcus.gif | Bin 826 -> 841 bytes data/modules/animations.lua | 11 +++++++++++ data/modules/ia/gota.lua | 7 +++++++ data/modules/ia/hero.lua | 12 ++++++++---- data/modules/sprites.lua | 5 +++++ data/modules/templates.lua | 17 +++++++++++++++++ 6 files changed, 48 insertions(+), 4 deletions(-) diff --git a/data/gfx/morcus.gif b/data/gfx/morcus.gif index 16ba539c4a4c2df134d8f9eefc40ec0bd2afb810..afb6b7d3dcf0cc115ca8b6c85cf759a2b14b818b 100644 GIT binary patch delta 366 zcmV-!0g?W?2FV7nZ^fY~K#GBY+0T5=u+Za8v^W0UB5z9k3cQaUs7K zNSHp|cxT|kUB4cUo$_$egk!h(O+3Kfz83%dE^*%P#TnG33kQEcmzn_YbEplF?>+C_ z+SFAy2WI>!AOQ?M#1|aKeitDI#BZqmMO=jM@u1**0}5at2O22w7X$lAmYjk98KS_6 zC>|AGfd}@s;(`V?INNNBXcs_>Xicz}Z!v~t--!>LNM8T~^d*1*3asOy0Cy0Hq>>(9 zR>F}?Zgw1!NuFl-9%e@Zsih6E(Rc%sCwQoY2|=0}R$uEJu+AJuw#nuLN5VO0on26Q zQ~-0j$y;xH`spV*4g%5Vn=c&tXKz$CTBQ(mmSE(gkTR(!P);;DC7usy>LjI@eoE%0 Ml}1Wx3n2giJAZwld;kCd delta 351 zcmV-l0igcL2D%2YW0@z&M*c)UaTI0uBlm00JzOt&_lW7&qP=!0HXnk0Wa^ znbrwt$O}gQBpg6P0Lfdq8iE}=)Q;ASC4`pX+B5?J8c-h{aGG&%5*l(#Sk9Y4=G?ng zul@`jGH=g>MI?6}U~gZGf0CE*?)PG01`Bjs$3B;u0PAz84M=~#JMY}r%$FZGM2$ZD z6F&5(o&pkp1r%g68oc;BM^A5P$&gaiD<$e=#thW5E$vbiHNjr3ofwvTAwCcydlU90fB*`tgP{O-ObDcq7*1Bgk3?Sf8<0VU zh@yK?>WE>BBoJ45!j&KmBPACB^tH|b>&)@vm|{NgqnT;0*#(nFg-IqmWrii^m~~<~ xLz;6=#%G?lF)3)1LabSWkAxOVB%FHAAn1~AKJ=)OiLy2+qly}eX$v6$06QKZnP30_ diff --git a/data/modules/animations.lua b/data/modules/animations.lua index 026c6d6..14c019f 100644 --- a/data/modules/animations.lua +++ b/data/modules/animations.lua @@ -265,4 +265,15 @@ animations = { { frame={x=16,y=0,w=8,h=8}, wait=4 } } }, + ["polseta"] = { + cycle = {1,2,3,4,5}, + loop = false, + frames = { + { frame={x=112,y=9,w=4,h=4}, wait=3 }, + { frame={x=112,y=13,w=4,h=4}, wait=3 }, + { frame={x=116,y=9,w=4,h=4}, wait=3 }, + { frame={x=116,y=13,w=4,h=4}, wait=3 }, + { frame={x=116,y=13,w=4,h=4}, wait=1 } + } + }, } \ No newline at end of file diff --git a/data/modules/ia/gota.lua b/data/modules/ia/gota.lua index b2266e3..f7d7f1f 100644 --- a/data/modules/ia/gota.lua +++ b/data/modules/ia/gota.lua @@ -58,3 +58,10 @@ function ia.update_gota_esguit(spr) spr.pos.x = spr.pos.x + spr.dir.x end +function ia.update_polseta(spr) + if spr.current_frame==5 then sprites.remove(spr) return end + + spr.dir.y = spr.dir.y + 0.1; + spr.pos.y = spr.pos.y + spr.dir.y + spr.pos.x = spr.pos.x + spr.dir.x +end diff --git a/data/modules/ia/hero.lua b/data/modules/ia/hero.lua index b5c6c65..8eee8a4 100644 --- a/data/modules/ia/hero.lua +++ b/data/modules/ia/hero.lua @@ -109,7 +109,7 @@ function ia.update_hero() sprites.hero.jumping = 0 sprites.hero.jump_throttle = 10 end - sprites.hero.jumping = sprites.hero.jumping - 1 + sprites.hero.jumping = sprites.hero.jumping - 1 --0.47 else -- SI NO ESTÀ BOTANT... -- SI ESTÀ EN UNES ESCALERES... @@ -161,16 +161,16 @@ function ia.update_hero() -- SI NO ESTÀ CAIGUENT... if tile_under_me1==84 then map.tile(tx1,ty+2,68) - local broken_tile = templates.create("brick", {pos={x=tx1<<3, y=(ty+2)<<3}, flipped=sprites.hero.flipped}) + local broken_tile = templates.create("brick", {pos={x=sprites.tile_to_pixel(tx1), y=sprites.tile_to_pixel(ty+2)}, flipped=sprites.hero.flipped}) table.insert(sprites.list, broken_tile) end if tile_under_me2==84 then map.tile(tx2,ty+2,68) - local broken_tile = templates.create("brick", {pos={x=tx2<<3, y=(ty+2)<<3}, flipped=sprites.hero.flipped}) + local broken_tile = templates.create("brick", {pos={x=sprites.tile_to_pixel(tx2), y=sprites.tile_to_pixel(ty+2)}, flipped=sprites.hero.flipped}) table.insert(sprites.list, broken_tile) end if tile_under_me1>=16 or tile_under_me1>=16 then - sprites.hero.pos.y = (ty<<3)-1 + sprites.hero.pos.y = sprites.tile_to_pixel(ty)-1 end anim = "hero_stand" if sprites.hero.state == templates.ALIVE then sprites.save_safe_pos() end @@ -188,6 +188,10 @@ function ia.update_hero() -- SI POLSA BOTAR... if ( key.down(key.X) or pad.down(pad.A) ) and sprites.hero.jump_throttle == 0 then sprites.hero.jumping = 17 + table.insert(sprites.list, templates.create("polseta", {pos={x=sprites.hero.pos.x+6, y=sprites.hero.pos.y+16}, dir={x=-0.7,y=-0.3}, flipped=sprites.hero.flipped})) + table.insert(sprites.list, templates.create("polseta", {pos={x=sprites.hero.pos.x+8, y=sprites.hero.pos.y+15}, dir={x=-0.5,y=-0.1}, flipped=sprites.hero.flipped})) + table.insert(sprites.list, templates.create("polseta", {pos={x=sprites.hero.pos.x+10, y=sprites.hero.pos.y+16}, dir={x=0.7,y=-0.3}, flipped=sprites.hero.flipped})) + table.insert(sprites.list, templates.create("polseta", {pos={x=sprites.hero.pos.x+12, y=sprites.hero.pos.y+15}, dir={x=0.5,y=-0.1}, flipped=sprites.hero.flipped})) -- SI POLSA DISPAR... elseif (sprites.hero.gun_cooldown==0) and (key.down(key.Z) or pad.down(pad.B)) then diff --git a/data/modules/sprites.lua b/data/modules/sprites.lua index 00f1af1..0f62007 100644 --- a/data/modules/sprites.lua +++ b/data/modules/sprites.lua @@ -14,6 +14,11 @@ function sprites.get_tile(num) return math.floor(num/8); end +function sprites.tile_to_pixel(num) + return math.floor(num)*8; +end + + function sprites.remove(sprite) for i,v in ipairs(sprites.list) do if v == sprite then diff --git a/data/modules/templates.lua b/data/modules/templates.lua index 172e790..3eb7f77 100644 --- a/data/modules/templates.lua +++ b/data/modules/templates.lua @@ -328,6 +328,23 @@ function me.create(type, options) room = options.room, ia = ia.update_ratpenat } + elseif key == "polseta" then + sprite = { + type = key, + pos = options.pos,--{ x=100, y=4*12*8+71 }, + dir = options.dir, + size = { w=4,h=4 }, + bbo = { left=0, top=0, right=0, bottom=0 }, + current_frame = 1, + current_wait = 1, + flipped = options.flipped, + surf = surf.load("gfx/morcus.gif"), + animation = "polseta", + state = me.ALIVE, + enemy = true, + room = options.room, + ia = ia.update_polseta + } else error("Template not recognized") end