From 54358fd691df26af420a68c8481f37612f28a2c5 Mon Sep 17 00:00:00 2001 From: JailDoctor Date: Wed, 1 Feb 2023 14:47:06 +0100 Subject: [PATCH] - FIXED: El actor principal ja no camina botant frames --- data/actors.lua | 12 ++++++++---- data/main.lua | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/data/actors.lua b/data/actors.lua index 9aa9f08..f1a09ac 100644 --- a/data/actors.lua +++ b/data/actors.lua @@ -1,5 +1,6 @@ actors={ list={}, + updating=false, add=function(actor) actor.dx,actor.dy=0,0 @@ -26,12 +27,9 @@ actors={ draw=function() for i,v in ipairs(actors.list) do local frame=((v.dx+v.dy)%2)*16 - --print(v.o) if v.o=='u' then - --print(v.dy>1.." "..frame) sspr(v.gfx.x+frame,v.gfx.y+16,16,16,v.x*8-4+v.dx*2,v.y*8-12+v.dy*2,16,16,v.dy>1) elseif v.o=='d' then - --print(-v.dy>1.." "..frame) sspr(v.gfx.x+frame,v.gfx.y,16,16,v.x*8-4+v.dx*2,v.y*8-12+v.dy*2,16,16,-v.dy>2) elseif v.o=='l' then sspr(v.gfx.x+frame,v.gfx.y+32,16,16,v.x*8-4+v.dx*2,v.y*8-12+v.dy*2,16,16) @@ -42,6 +40,9 @@ actors={ end, update=function() + if actors.updating then return end + actors.updating=true + local needs_sorting=false for i,v in ipairs(actors.list) do if v.dx==0 and v.dy==0 then @@ -56,7 +57,8 @@ actors={ local switch = switches.search(v.x,v.y) if switch then switch.action() end end - else + end + if v.path and v.path.pos ~= #v.path.route then v.path.pos=v.path.pos+1 local step=string.sub(v.path.route,v.path.pos,v.path.pos) if step=='u' then @@ -106,6 +108,8 @@ actors={ if needs_sorting then table.sort(actors.list, compare_actors) end + + actors.updating=false end } diff --git a/data/main.lua b/data/main.lua index 726bda8..ac0030e 100644 --- a/data/main.lua +++ b/data/main.lua @@ -6,7 +6,7 @@ function _init() setsource(tiles) local pal=loadpal("tiles.gif") setpal(pal) - beat(12) + beat(6) fade.init() main_init() end