From 737a62b45029a5780f3200a4689b6e6c1ad75130 Mon Sep 17 00:00:00 2001 From: JailDoctor Date: Wed, 1 Feb 2023 15:05:43 +0100 Subject: [PATCH] =?UTF-8?q?-=20WIP:=20Men=C3=BA=20del=20joc=20i=20objectes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/game.lua | 26 +++++++++++++++++++++++--- data/main.lua | 1 + 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/data/game.lua b/data/game.lua index 1ab241d..1f9cae6 100644 --- a/data/game.lua +++ b/data/game.lua @@ -33,14 +33,17 @@ game={ end, show_menu=function() + game.pause() menu.show({ {"GUARDAR PARTIDA", editor.new}, {"CARREGAR PARTIDA", function() textbox.show("FILENAME TO LOAD:",editor.load, mapa.name) end}, {"EIXIR", function() if mapa.name~=nil then editor.save(mapa.name) else textbox.show("FILENAME TO SAVE:",editor.save, mapa.name) end end}, {"EXIT", main_init}, - }, function()editor.paused=false end) + }, function() game.resume() end) end, update=function() + if game.paused then return end + local hero = actors.search("jailer") if hero then game.cam.x = hero.x*8 + hero.dx*2 - 80 @@ -64,11 +67,28 @@ game={ hero.path={pos=0,route='l',keys=true} elseif btn(KEY_RIGHT) then hero.path={pos=0,route='r',keys=true} - elseif btnp(KEY_ESCAPE) then - game.show_menu() end end + if btnp(KEY_ESCAPE) then + game.show_menu() + end if beat() then actors.update() end + end, + + pause=function() + game.paused = true + rectfill(10,84, 150, 128,6) + rect(10,84, 150, 128,8) + rect(9,83, 151, 129,6) + text("OBJECTES:",14,82,8) + setsource(objectes) + sspr(0,0,16,16,14,89) + sspr(0,0,16,16,34,89) + sspr(0,0,16,16,14,109) + end, + + resume=function() + game.paused = nil end } \ No newline at end of file diff --git a/data/main.lua b/data/main.lua index ac0030e..65f665b 100644 --- a/data/main.lua +++ b/data/main.lua @@ -2,6 +2,7 @@ function _init() menu_option=0 sprites=loadsurf("sprites.gif") + objectes=loadsurf("objects.gif") tiles=loadsurf("tiles.gif") setsource(tiles) local pal=loadpal("tiles.gif")