From a98a46a3d2ac802a510c7548d78c8e3f41770169 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Mon, 23 Mar 2026 18:46:27 +0100 Subject: [PATCH] =?UTF-8?q?-=20[NEW]=20guardem=20una=20safe=5Fpos=20al=20e?= =?UTF-8?q?ntrar=20en=20cada=20habitaci=C3=B3=20-=20[FIX]=20Al=20morir,=20?= =?UTF-8?q?o=20tornar=20al=20editor,=20se=20reseteja=20l'heroi=20-=20[FIX]?= =?UTF-8?q?=20Ja=20no=20canvia=20d'habitaci=C3=B3=20al=20asomar=20el=20cab?= =?UTF-8?q?et=20per=20dalt=20al=20botar=20-=20[NEW]=20M=C3=A9s=20habitacio?= =?UTF-8?q?ns=20(21%)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/maps/rooms_background.gif | Bin 1364 -> 1538 bytes data/maps/rooms_foreground.gif | Bin 2119 -> 2221 bytes data/maps/rooms_items.gif | Bin 1070 -> 1107 bytes data/modules/ia/hero.lua | 21 +++++++++++++++++---- data/modules/sprites.lua | 18 +++++++++--------- data/stages/editor.lua | 4 ---- data/stages/game.lua | 2 +- 7 files changed, 27 insertions(+), 18 deletions(-) diff --git a/data/maps/rooms_background.gif b/data/maps/rooms_background.gif index f1a7e2d3ca5db87b7b39c938ad8dea0abc1dcd78..be3c2dafdfd9e9ff57123a6ec27e8cc311273e48 100644 GIT binary patch delta 323 zcmV-J0lfay3W5x<3IhRuvkL>o0e^5AndF{P&9~lEO}_MCZ8T2Af(eHr3Q?O5l}8c?qkiW%B9otW3aUb( zW*MuYiuPKOq}_43E2x#CaA~Fp-Jl(dnF0%@rKc7Y?WD>Ls816$Isv9i3ATgX17FjrKvA*qEM_H<(V*C-uJ9#{5sOj1OvO~*tsF240 zhAfs1VVo0e?y6sV80Ctv6MZWW7ic3nma+C`jc|$6j?XibZ2Z zgc@pSYLKy4qFR++6zM>dwl-m=YBd_sriUW>X^^C;u!5>4u-YG(tm!$hgRCad>Jbu2 zoSGM|Ibo57u6X&n6R?GLx+Rz1v0!YK#F|M^vt|V)5dalY+mN*iL5A&(dj&2S5CA(r Ca6i@n diff --git a/data/maps/rooms_foreground.gif b/data/maps/rooms_foreground.gif index bb72d60af873d11adefe4a24979137d5fb441d1a..481c1e43f10dd71c9e86fb1c0914d8fd1e55fa42 100644 GIT binary patch delta 568 zcmV-80>}Nw5Umlg3IhWG006TM1APO3A}s9sLbrcA!sQGBT{~3NTLc;43tLvX90VZWR|`xe>To7s@bUsVM7vYCXyQtitT+9GhR22NlmLV{2PJa-=g zPA`H43{+JXh$BUr?tzkf*R>#suib&AG9i!wsS*f)i`~vtFw|9)s>iHxQLJ`<-LqZA zd}XedX{LoUfWfr?SSX}^O+*GDn4s@26Cc}z;B6GyjM*480}yDbaWbGl1^zZahFobT z(9=(&LNb>gJuOL(Vju|b7l0X%padteq7_T$9pb$XSJ>L%1nA^05KPNq)bbpYmT0gN zPD)62Y?H`@HG)3|4_SJPK_Vr8lEdxT(OfnZl|-l_tuQhYRwWxj2&h1XQBuKxMwG~{ z_Gpo5&BTV2e53-ICJ~(t50Y83iT^UWs@Ca+L3J8aRZRGhaZxZM^Qzq|Gcpqi#*!sO zxJpH2K+U%?uOWY&)*nA7saVcLi!K2t*{F9v^noOr37mmCF=ndOP0NOV5?*^HDyzqstN^RK+1v|^kO;EnL@-#I>LeQcmVk0xUv~hhs3gNN~x$r z4~MjlE~{`L{h*NMn4(dMQg_^|m;nQ}EYD>spOcG{3%{qUcPhlD0Enlk?x(3C*$`_n z1S(A}C#AayRb2<1z|H_CS}>kY#8jDcsNOO)QW;$9rW&0nR;M*N?@{%mU{%Oh3(1gx G0028F(fxY> delta 465 zcmV;?0WSWn5yud)3IhZC{QR>G1APO3wcq~j2$wSibnQ@4ZxLjGFN770D9@~Z%``JM zCS(ZSDrnd*)1N;36%qaeO^2bRi&KnA25U`#@AJ5!lZS6E9S_g1LF7OqftE>s~5Sx7_e*{+6vBj{IK zDg%QVz+hS;BpmGj-XsGMFfS*^`_%+O@HUEU#%v6l0SL6zI2ll&0)KPeL#_lqq1aGZ zBk0l7lJqD8CNKi>3&0FWP=b?8(RdNmR2-4Vw55SyS`MR@=a}R>B?fC_bxhBwIJmX! zy^wN*99RU#Ri&UoKw8kN2lYva!9F=G<05H--5DQ}j z^unMzjj1YzjAbGn^2Lcn2|^8n2@$SR5gGXMZAZKpD3Le;AGY!(yAyWxIM9L;^q>Y!=nB;pzzOVZQ?QaB7<1&zWld5@cYJ1G H0s;U#P4CO! diff --git a/data/maps/rooms_items.gif b/data/maps/rooms_items.gif index a9fc66a017be6764765514e42d8367c1ec2cf6fb..ac69a883f5ca9affa2f420803dcaea8525f27420 100644 GIT binary patch delta 84 zcmV-a0IUD52-66#2Lw#swDUmg3b7NkuKnP1hSViCI3M^OVg!oaZHDhye!WZvaMNQ= qEI(v@f%lz*WVAEC^yLP;w17tLu~eR99i2Cjf@u}_--9Ft1OPk0!zZi& delta 47 zcmV+~0MP%_2(AdQ2LvZBU10Np&rNm?n;igk>DwEJ6F)fqC8O%-;V#hlJ-z$)@K*)| F06XEi6?Xst diff --git a/data/modules/ia/hero.lua b/data/modules/ia/hero.lua index e21dc9c..9484424 100644 --- a/data/modules/ia/hero.lua +++ b/data/modules/ia/hero.lua @@ -95,11 +95,11 @@ function ia.update_hero() --draw.rect(tx1<<3,ty<<3,8,8,8) --draw.rect(tx2<<3,ty<<3,8,8,28) if map.tile(tx1,ty) == 0 and map.tile(tx2,ty) == 0 then - if ty+1 1 then sprites.hero.pos.y = sprites.hero.pos.y - 1 end - end + --end else sprites.hero.jumping = 0 sprites.hero.jump_throttle = 10 @@ -165,6 +165,7 @@ function ia.update_hero() end sprites.hero.pos.y = (ty<<3)-1 anim = "hero_stand" + sprites.save_safe_pos() -- SI ESTÀ SOBRE UNES ESCALERES I POLSA AVALL... if (map.tile(txm,ty+2) < 16 and map.tile(txm,ty+2) > 0) then if key.down(key.DOWN) or pad.down(pad.DOWN) then @@ -261,3 +262,15 @@ function ia.hero_give_key(color) tweening.add(1,0,0.25,easing.linear,function(value,n,finished)palfade.fade_white(value)end) return true end + +function ia.hero_reset() + sprites.hero.state = templates.ALIVE + sprites.hero.lives = 4 + sprites.hero.surf = surf.load("gfx/morcus.gif") + sprites.hero.animation = "hero_stand" + sprites.hero.current_frame = 1 + sprites.hero.current_wait = 1 + sprites.hero.flipped = false + sprites.hero.light = 100 + sprites.hero.pos = {x=sprites.last_safe_pos.x,y=sprites.last_safe_pos.y} +end \ No newline at end of file diff --git a/data/modules/sprites.lua b/data/modules/sprites.lua index 7bb77d8..acda3f7 100644 --- a/data/modules/sprites.lua +++ b/data/modules/sprites.lua @@ -5,6 +5,9 @@ sprites = { hero = nil, list = {}, pause_ia = false, + --initial_pos = { x=28, y=4*13*8+79 } + last_safe_room = 0 + 4 * 8, + last_safe_pos = { x=28, y=4*13*8+79 } } function sprites.remove(sprite) @@ -17,15 +20,12 @@ function sprites.remove(sprite) end end -function sprites.remove_out_of_room() - --print("Current room: "..rooms.current()) - --for i,v in ipairs(sprites.list) do - -- if v.room ~= rooms.current() then - -- table.remove(sprites.list, i) - -- local room = v.room or 0 - -- print("Sprite at room "..room.." removed: "..v.type) - -- end - --end +function sprites.save_safe_pos() + local room = (rooms.pos.x//20) + (rooms.pos.y//12) * 8 + if room ~= sprites.last_safe_room then + sprites.last_safe_room = room + sprites.last_safe_pos = {x=sprites.hero.pos.x, y=sprites.hero.pos.y} + end end function sprites.add_from_room(rx,ry) diff --git a/data/stages/editor.lua b/data/stages/editor.lua index 50e8303..097b081 100644 --- a/data/stages/editor.lua +++ b/data/stages/editor.lua @@ -130,19 +130,15 @@ editor = { menu.toggle() elseif key.press(key.RIGHT) and rooms.pos.x < 20*7 then rooms.pos.x = rooms.pos.x + 20 - sprites.remove_out_of_room() sprites.add_from_room(rooms.pos.x, rooms.pos.y) elseif key.press(key.LEFT) and rooms.pos.x > 0 then rooms.pos.x = rooms.pos.x - 20 - sprites.remove_out_of_room() sprites.add_from_room(rooms.pos.x, rooms.pos.y) elseif key.press(key.DOWN) and rooms.pos.y < 13*7 then rooms.pos.y = rooms.pos.y + 13 - sprites.remove_out_of_room() sprites.add_from_room(rooms.pos.x, rooms.pos.y) elseif key.press(key.UP) and rooms.pos.y > 0 then rooms.pos.y = rooms.pos.y - 13 - sprites.remove_out_of_room() sprites.add_from_room(rooms.pos.x, rooms.pos.y) elseif key.press(key.TAB) or key.press(key.ESCAPE) then if editor.layer==LAYER_BACKGROUND or editor.layer==LAYER_FOREGROUND then diff --git a/data/stages/game.lua b/data/stages/game.lua index 7f5f4e7..4e2968b 100644 --- a/data/stages/game.lua +++ b/data/stages/game.lua @@ -65,6 +65,7 @@ game = { if key.press(key.ESCAPE) or key.press(key.F9) then rooms.reload() sprites.add_from_room(rooms.pos.x, rooms.pos.y) + ia.hero_reset() editor.enable() elseif key.press(key.GRAVE) then console.enable() @@ -106,7 +107,6 @@ game = { game.chg_step = game.chg_step - 1 if game.chg_step == 0 then - sprites.remove_out_of_room() sprites.pause_ia = false app.pop() --sys.beat(2)