- [NEW] Es pot arrastrar un item per a recolocar-lo en l'habitació
This commit is contained in:
@@ -11,6 +11,8 @@ editor = {
|
||||
modified = false,
|
||||
item_selected=nil,
|
||||
item_hovered=nil,
|
||||
item_dragged=nil,
|
||||
dragged_start_pos=nil,
|
||||
flip=false,
|
||||
|
||||
enable = function()
|
||||
@@ -74,6 +76,27 @@ editor = {
|
||||
end
|
||||
end
|
||||
else
|
||||
if editor.item_dragged then
|
||||
if mouse.down(mouse.LEFT) then
|
||||
local sprite = sprites.list[editor.item_dragged]
|
||||
--sprite.pos.x, sprite.pos.y = tx*8, ty*8
|
||||
sprite.pos = {x=tx*8, y=ty*8}
|
||||
else
|
||||
map.surf(rooms.surf_items)
|
||||
local tile = map.tile(editor.dragged_start_pos.x//8,editor.dragged_start_pos.y//8)
|
||||
map.tile(editor.dragged_start_pos.x//8,editor.dragged_start_pos.y//8,0)
|
||||
map.tile(tx,ty,tile)
|
||||
editor.item_dragged = nil
|
||||
--local sprite = sprites.list[editor.item_dragged]
|
||||
--sprite.pos.x,sprite.pos.y = editor.dragged_start_pos.x,editor.dragged_start_pos.y
|
||||
end
|
||||
elseif mouse.down(mouse.LEFT) and editor.item_hovered then
|
||||
editor.item_dragged = editor.item_hovered
|
||||
--print("item dragged: "..editor.item_dragged.."\n")
|
||||
local sprite = sprites.list[editor.item_dragged]
|
||||
editor.dragged_start_pos = {x=sprite.pos.x, y=sprite.pos.y}
|
||||
editor.modified = true
|
||||
end
|
||||
if mouse.press(mouse.LEFT) then
|
||||
if editor.item_selected then
|
||||
map.surf(rooms.surf_items)
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1001 B After Width: | Height: | Size: 1001 B |
Reference in New Issue
Block a user