From e4e1e59e8b7b6fc340309cfe6d51cb4c27403422 Mon Sep 17 00:00:00 2001 From: JailDoctor Date: Sat, 28 Jan 2023 09:02:27 +0100 Subject: [PATCH] - [NEW][EDITOR] Copy tile -[NEW][EDITOR] Flood fill --- data/editor.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/data/editor.lua b/data/editor.lua index 29fbd53..7a6b288 100644 --- a/data/editor.lua +++ b/data/editor.lua @@ -18,6 +18,15 @@ editor={ }, function()editor.paused=false end) end, + floodfill=function(x,y,tile) + local t=mget(x,y) + mset(x,y,tile) + if x0 and mget(x-1,y)==t then editor.floodfill(x-1,y,tile) end + if y0 and mget(x,y-1)==t then editor.floodfill(x,y-1,tile) end + end, + update=function() cls() camera(editor.cam.x, editor.cam.y) @@ -38,6 +47,12 @@ editor={ if btnp(KEY_LEFT) then editor.cam.x=editor.cam.x-8 end if btnp(KEY_UP) then editor.cam.y=editor.cam.y-8 end if btnp(KEY_DOWN) then editor.cam.y=editor.cam.y+8 end + if btnp(KEY_F) then + editor.floodfill(tx,ty,editor.selected_tile) + end + if btnp(KEY_RETURN) then + editor.selected_tile=mget(tx,ty) + end if btnp(KEY_ESCAPE) then editor.paused=true editor.show_menu()