- [NEW][EDITOR] Copy tile
-[NEW][EDITOR] Flood fill
This commit is contained in:
@@ -18,6 +18,15 @@ editor={
|
|||||||
}, function()editor.paused=false end)
|
}, function()editor.paused=false end)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
floodfill=function(x,y,tile)
|
||||||
|
local t=mget(x,y)
|
||||||
|
mset(x,y,tile)
|
||||||
|
if x<mapa.w-1 and mget(x+1,y)==t then editor.floodfill(x+1,y,tile) end
|
||||||
|
if x>0 and mget(x-1,y)==t then editor.floodfill(x-1,y,tile) end
|
||||||
|
if y<mapa.h-1 and mget(x,y+1)==t then editor.floodfill(x,y+1,tile) end
|
||||||
|
if y>0 and mget(x,y-1)==t then editor.floodfill(x,y-1,tile) end
|
||||||
|
end,
|
||||||
|
|
||||||
update=function()
|
update=function()
|
||||||
cls()
|
cls()
|
||||||
camera(editor.cam.x, editor.cam.y)
|
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_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_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_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
|
if btnp(KEY_ESCAPE) then
|
||||||
editor.paused=true
|
editor.paused=true
|
||||||
editor.show_menu()
|
editor.show_menu()
|
||||||
|
|||||||
Reference in New Issue
Block a user