From b263d989d0781d27572c62acca67d535569af363 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Sat, 15 Nov 2025 14:26:08 +0100 Subject: [PATCH] =?UTF-8?q?-=20[NEW]=20Es=20pot=20arrastrar=20un=20item=20?= =?UTF-8?q?per=20a=20recolocar-lo=20en=20l'habitaci=C3=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/editor.lua | 23 +++++++++++++++++++++++ data/rooms_foreground.gif | Bin 1728 -> 1728 bytes data/rooms_items.gif | Bin 1001 -> 1001 bytes 3 files changed, 23 insertions(+) diff --git a/data/editor.lua b/data/editor.lua index 01e9622..67f3486 100644 --- a/data/editor.lua +++ b/data/editor.lua @@ -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) diff --git a/data/rooms_foreground.gif b/data/rooms_foreground.gif index 702b50011823078065cdc27cd7fc9beb48311112..3f549853f25e3384d0a54b48ecd0329e0f873b65 100644 GIT binary patch delta 16 XcmX@Wdw_QX7c(;h1H)!s=FQ9iCI|!6 delta 16 YcmX@Wdw_QX7c=wkKYup!GH+%E06MG&#{d8T diff --git a/data/rooms_items.gif b/data/rooms_items.gif index 82ac77387abdaf2863e25102c8adf764d37e52c5..b870048627d92f9c5b7d1d0ca806baf3747e6998 100644 GIT binary patch delta 24 gcmaFK{*rwI7c+Ah1H)uq=4C9oY-$pdw=)|709V`wbN~PV delta 24 gcmaFK{*rwI7c=wkKYu3kGB0B(W@8hWyq(zy0Db@n?*IS*