From adee527d70fbbb8c8a5891dc101e28995625900a Mon Sep 17 00:00:00 2001 From: JailDoctor Date: Sun, 29 Jan 2023 17:51:52 +0100 Subject: [PATCH] - [NEW][EDITOR] Mostra coordenades tile baix cursor - [NEW][EDITOR] Displace map --- data/editor.lua | 52 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/data/editor.lua b/data/editor.lua index cee987a..9ad7829 100644 --- a/data/editor.lua +++ b/data/editor.lua @@ -58,6 +58,35 @@ editor={ end end, + displace=function(dx,dy) + local w,h=mapa.w,mapa.h + if dx>0 then + for y=0,h-1 do + for x=w-1,1,-1 do + mset(x,y,mget(x-1,y)) + end + end + elseif dx<0 then + for y=0,h-1 do + for x=0,w-2 do + mset(x,y,mget(x+1,y)) + end + end + elseif dy>0 then + for y=h-1,1,-1 do + for x=0,w-1 do + mset(x,y,mget(x,y-1)) + end + end + elseif dy<0 then + for y=0,h-2 do + for x=0,w-1 do + mset(x,y,mget(x,y+1)) + end + end + end + end, + update=function() cls() camera(editor.cam.x, editor.cam.y) @@ -74,7 +103,12 @@ editor={ rect(rx1-1, ry1-1, rx2+8, ry2+8, 8) end camera(0,0) - + if tx>=0 and + ty>=0 and + tx