From f6b99d792422c3fc907241aa8c6f7841d556820c Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Wed, 4 Mar 2026 11:08:16 +0100 Subject: [PATCH] =?UTF-8?q?-=20[FIX]=20Si=20hi=20ha=20que=20ficar=20un=20o?= =?UTF-8?q?ffset=20en=20algun=20frame=20de=20animaci=C3=B3,=20es=20f=C3=A0?= =?UTF-8?q?=20des=20de=20la=20propia=20animaci=C3=B3,=20no=20canviant=20la?= =?UTF-8?q?=20posici=C3=B3=20del=20personatge=20-=20[NEW]=20rooms.reload()?= =?UTF-8?q?=20-=20[FIX]=20Al=20tornar=20al=20editor,=20se=20recarrega=20to?= =?UTF-8?q?t=20de=20nou=20-=20[NEW]=20Si=20se=20juga=20des=20de=20un=20min?= =?UTF-8?q?i=20de=20debug=20comen=C3=A7a=20en=20l'editor.=20Si=20se=20juga?= =?UTF-8?q?=20des=20del=20mini=20normal=20comen=C3=A7a=20en=20el=20joc.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/animations.lua | 6 +++--- data/game.lua | 3 ++- data/main.lua | 6 +++++- data/rooms.lua | 38 +++++--------------------------------- data/rooms_foreground.gif | Bin 2020 -> 2023 bytes data/rooms_items.gif | Bin 1038 -> 1038 bytes data/sprites.lua | 14 ++++++++++---- 7 files changed, 25 insertions(+), 42 deletions(-) diff --git a/data/animations.lua b/data/animations.lua index 519ef14..53e9fa6 100644 --- a/data/animations.lua +++ b/data/animations.lua @@ -36,9 +36,9 @@ animations = { ["hero_shoot"] = { cycle = {1,2,3}, frames = { - { frame={x=64,y=0,w=24,h=17}, wait=4 }, - { frame={x=88,y=0,w=24,h=17}, wait=2 }, - { frame={x=88,y=0,w=24,h=17}, wait=2 } + { frame={x=64,y=0,w=24,h=17}, offset={flipped={x=-8,y=0}}, wait=4 }, + { frame={x=88,y=0,w=24,h=17}, offset={flipped={x=-8,y=0}}, wait=2 }, + { frame={x=88,y=0,w=24,h=17}, offset={flipped={x=-8,y=0}}, wait=2 } } }, ["bullet"] = { diff --git a/data/game.lua b/data/game.lua index 4e2bff8..2760c01 100644 --- a/data/game.lua +++ b/data/game.lua @@ -63,7 +63,8 @@ game = { game.apply_light() if key.press(key.ESCAPE) or key.press(key.F9) then - rooms.retrieve_original_items() + rooms.reload() + sprites.add_from_room(rooms.pos.x, rooms.pos.y) editor.enable() elseif key.press(key.GRAVE) then console.enable() diff --git a/data/main.lua b/data/main.lua index 0966ab5..2b26f65 100644 --- a/data/main.lua +++ b/data/main.lua @@ -21,7 +21,11 @@ function mini.init() rooms.init() shader.init("lynx.glsl") - editor.enable() + if sys.debug() then + editor.enable() + else + game.enable() + end sprites.add_from_room(rooms.pos.x, rooms.pos.y) end diff --git a/data/rooms.lua b/data/rooms.lua index 712f708..4748b83 100644 --- a/data/rooms.lua +++ b/data/rooms.lua @@ -20,8 +20,7 @@ rooms = { return (rooms.pos.x//20) + (rooms.pos.y//12) * 8 end, - init = function() - rooms.pos.x, rooms.pos.y = 0,4*12 + reload = function() if rooms.surf_background ~= nil then surf.free(rooms.surf_background) end rooms.surf_background = surf.load("rooms_background"..ROOM_FILE_EXT) --rooms.surf_background = surf.new(20*8,12*8) @@ -33,27 +32,12 @@ rooms = { if rooms.surf_items ~= nil then surf.free(rooms.surf_items) end rooms.surf_items = surf.load("rooms_items"..ROOM_FILE_EXT) --rooms.surf_items = surf.new(20*8,12*8) - - rooms.surf_original_items = surf.new(20*8,12*8) - rooms.update_original_items() - --surf.source(rooms.surf_items) - --surf.target(rooms.surf_original_items) - --draw.surf(0,0,160,96,0,0) + end, + init = function() + rooms.pos.x, rooms.pos.y = 0,4*12 + rooms.reload() sprites.init() - - --map.surf(rooms.surf_background) - --for y=0,12*8 do - -- for x=0,20*8 do - -- map.tile(x,y,38) - -- end - --end - --map.surf(rooms.surf_foreground) - --map.tile(10,10,16) - - --surf.save(rooms.surf_background, "data/rooms_background.bin") - --surf.save(rooms.surf_foreground, "data/rooms_foreground.bin") - --surf.save(rooms.surf_items, "data/rooms_items.bin") end, save = function() @@ -143,16 +127,4 @@ rooms = { pal.color(1, 1, 1, 1) return "HOLA OTHER UNIT" end, - - retrieve_original_items = function() - surf.source(rooms.surf_original_items) - surf.target(rooms.surf_items) - draw.surf(0,0,160,96,0,0) - end, - - update_original_items = function() - surf.source(rooms.surf_items) - surf.target(rooms.surf_original_items) - draw.surf(0,0,160,96,0,0) - end } diff --git a/data/rooms_foreground.gif b/data/rooms_foreground.gif index 65e7901cffefc5de0d20055b18738f06bcb1aed7..649bcee356f45749032f23e5d182228eba99dae0 100644 GIT binary patch delta 164 zcmV;V09*g$59bfC3IhREvkLmZ=K>XAIHk zMgW5DWpH9O3?tE$H%8_$QbAMy2wRFx}=Ql z>DPgT__kzGswzL6qb%o`upr{^mio&jE_bQRUh-0IFANwQBM3cNwMkwISzHAr$joI7 PI