Right click to remove in editor; checks if key is down instead of clicking

This commit is contained in:
lustlion 2022-01-29 11:52:57 +01:00
parent 3e8a907aa2
commit c4ef2f2e8c
1 changed files with 8 additions and 5 deletions

View File

@ -10,7 +10,6 @@ function EditorStep()
palette = true
palette_scroll_x = 0
palette_scroll_y = 0
selecting_tile = 51
end
end
if love.keyboard.isDown('a',"left") then
@ -77,14 +76,19 @@ function EditorDoEdit()
love.graphics.print("> " .. horizontal .. ", " .. vertical)
love.graphics.print("> " .. LevelWidth .. "(" .. expand_h .. "), " .. LevelHeight .. "(".. expand_v .. ")", 0, 10)
if Keybind:HasPressed(Keybind.generic.lclick) and not palette then
if not palette then
if LevelTiles[vertical] ~= nil
and LevelTiles[vertical][horizontal] ~= nil
and love.keyboard.isDown("lshift") ~= true
and love.keyboard.isDown("lctrl") ~= true
and selecting_tile ~= nil
then
InstanceTile(vertical,horizontal,selecting_tile)
if Keybind:CheckDown(Keybind.generic.lclick) then
InstanceTile(vertical,horizontal,selecting_tile)
elseif Keybind:CheckDown(Keybind.generic.rclick)
InstanceTile(vertical,horizontal,0)
end
LevelReloadTiles()
--[[
elseif love.keyboard.isDown("lshift") then
--ExpandCanvas(math.sign(expand_h),math.sign(expand_v))
@ -106,7 +110,6 @@ function EditorDoEdit()
Camera.pos.y = Camera.pos.y - expand_v*tileProperties.scale*tileProperties.height
end]]
end
LevelReloadTiles()
end
end
@ -173,7 +176,7 @@ function EditorDoPalette()
end
if Keybind:CheckDown(Keybind.generic.rclick) then
selecting_tile = 0
selecting_tile = nil
end
if selecting_tile ~= nil and selecting_tile ~= 0 and i == selecting_tile then