From 1271c74c53865071ad2db18e0bb368574aaa1267 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Fri, 20 Jun 2025 19:44:36 +0200 Subject: [PATCH] =?UTF-8?q?-=20[NEW]=20Animaci=C3=B3=20de=20caminar=20i=20?= =?UTF-8?q?d'estar=20quet=20de=20Morcus=20activades=20-=20[NEW]=20Es=20pot?= =?UTF-8?q?=20pasar=20quan=20es=20vullga=20del=20joc=20al=20editor=20i=20v?= =?UTF-8?q?iceversa=20-=20[NEW]=20Els=20shaders=20s'activen=20en=20el=20jo?= =?UTF-8?q?c=20i=20se=20desactiven=20en=20l'editor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/animations.lua | 12 +++++++++--- data/editor.lua | 15 +++++++++++++++ data/game.lua | 8 +++++++- data/main.lua | 2 ++ data/menu.lua | 1 + data/rooms.lua | 4 ---- data/rooms_foreground.bin | Bin 272 -> 274 bytes data/score.lua | 2 +- data/sprites.gif | Bin 1194 -> 1199 bytes data/sprites.lua | 25 +++++++++++++++++++++++-- 10 files changed, 58 insertions(+), 11 deletions(-) diff --git a/data/animations.lua b/data/animations.lua index 96902e7..69fc144 100644 --- a/data/animations.lua +++ b/data/animations.lua @@ -1,11 +1,17 @@ animations = { + ["hero_stand"] = { + cycle = {1}, + frames = { + { frame={x=0,y=0,w=16,h=17}, wait=2 }, + } + }, ["hero_walk"] = { cycle = {1,2,1,3}, frames = { - { frame={x=0,y=0,w=16,h=17}, wait=4 }, - { frame={x=16,y=0,w=16,h=17}, wait=4 }, - { frame={x=32,y=0,w=16,h=17}, wait=4 } + { frame={x=0,y=0,w=16,h=17}, wait=2 }, + { frame={x=16,y=0,w=16,h=17}, wait=2 }, + { frame={x=32,y=0,w=16,h=17}, wait=2 } } } } \ No newline at end of file diff --git a/data/editor.lua b/data/editor.lua index ccbf50f..2b9e691 100644 --- a/data/editor.lua +++ b/data/editor.lua @@ -12,6 +12,7 @@ editor = { enable = function() app.update = editor.update sys.beat(2) + shader.disable(); end, update = function() @@ -141,6 +142,20 @@ editor = { end end, + play=function() + if editor.modified then + msgbox.show("IE MEN!", + {"Hi ha canvis sense guardar.", "Vols guardar-los abans de jugar?"}, + { + {"Cancel", app.pop}, + {"No", function() app.pop() game.enable() end}, + {"Yes", function() app.pop() rooms.save() game.enable() end} + } ) + else + game.enable() + end + end, + picker = { show = function() diff --git a/data/game.lua b/data/game.lua index c4a75be..18da5ce 100644 --- a/data/game.lua +++ b/data/game.lua @@ -2,17 +2,23 @@ game = { enable = function() app.update = game.update - sys.beat(20) + sys.beat(2) + shader.enable(); end, update = function() view.origin(0,0) surf.target(0) + view.clip() score.draw() -- Pintar el mapa i sprites rooms.draw() + sprites.update() + if key.down(key.ESCAPE) then + editor.enable() + end end } \ No newline at end of file diff --git a/data/main.lua b/data/main.lua index 34bc6f6..e36c3f3 100644 --- a/data/main.lua +++ b/data/main.lua @@ -2,6 +2,7 @@ require "app" require "score" require "rooms" require "editor" +require "game" function mini.init() surf_sprites = surf.load("sprites.gif") @@ -10,6 +11,7 @@ function mini.init() pal.trans(0) rooms.init() + shader.init("lynx.glsl") editor.enable() end diff --git a/data/menu.lua b/data/menu.lua index 4f538da..ec82811 100644 --- a/data/menu.lua +++ b/data/menu.lua @@ -15,6 +15,7 @@ menu = { menu.option("FILE") popup.create("FILE", 1, 8) + popup.addOption("FILE", "Play", editor.play) popup.addOption("FILE", "Save", function() rooms.save() editor.modified=false end) popup.addOption("FILE", "Quit", editor.quit) diff --git a/data/rooms.lua b/data/rooms.lua index 7c7debf..b680cdf 100644 --- a/data/rooms.lua +++ b/data/rooms.lua @@ -47,9 +47,6 @@ rooms = { --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") - - --shader.init("lynx.glsl") - --shader.enable(); end, save = function() @@ -104,7 +101,6 @@ rooms = { --draw.surf(0, 0, 16, 17, 20, 15, 16, 17) end - sprites.update() -- Pintem la rejilla --for y=0,12 do draw.line(0,y*8, 160, y*8, 27) end --for x=0,20 do draw.line(x*8, 0, x*8, 104, 27) end diff --git a/data/rooms_foreground.bin b/data/rooms_foreground.bin index 8a1f60bd0edee3121ce9a4fb276ab30c2a049998..9b4868c59610ec563e0c8269a98157a7868d19f6 100644 GIT binary patch delta 76 zcmV-S0JHy)0+Ird7y)0&@1OPkpJR(y7 delta 74 zcmV-Q0JZ;;0+0fb7y89Ou+rp=o;DGoGnAg9ltJ_RBGO0;Opl}3{){YY}D)29`Y gLY+!AW{j#>r-shn zavI|j<_Z!Tf8q=R8t2lv8!)aMhjIJnDde(l!M$@5oVi0L0AeUb103R$aOl~>k1rZN z%qLNe07Vrw|9>c`bcaF4ascyn1WA*|Ispn4JjhuRhkyeI1mJwIGk}0bMu+ZP>9M9$ z5i9Isn?J~!-lPTv;@$uShSA)%C@cBw{YXiolCc_-Me`6>fOt? zFBT$A{n8C^;L!nffPo|y94!aX9y|CIu5;MkWIB}@2YtCcIk`Xw=My6IT*u2PG^( z*~p%f9r^T2S;YJ%VO?~SqC<%lDN~oY5-TA>%01VP6A&2-inBRreb>>7UhxJDkbVy|g zNrEIM;aCsbL1mhGSD_f1g)w?zoNqiDXM%G12`OBUNG7S|l1w(~%x~r<|yCQp%a4 z-129h4;=8N44T~13!t{}0!p4E9;!<=-c&hhH^%rPDVy9h;|!rhQ3XV&%@DY0NYqSV zO$h@GAlx(WRMSxapPrgYLHI170WGEufonj!YHF*m_G}caux!?&5k$N0iKa*!1u+A( z7JoU5rvD=3j3hyv4K16GwNT!KlTJBti_*ADfg7%IQi-|*yM?+t>=0s=u+|{;CUumR z(jH;yyhC*9ufPBgv4$RF9xNsf1(VkY8PjSv#+&LUIVUBt&Tuul#AdbS=Gn_`y8%IxN)Cby6C4Z-9B6Zk zb#aSyT7Z(1D*+A+mxTiy1Cf@4g@=hMpP7b;k(8>GmWPBBuz#>1_gCU|9>#3D2`vfj2vUiKqo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