added specific action keybinds to the editor
This commit is contained in:
parent
05bf757ea5
commit
5c9fc39fad
@ -1,8 +1,11 @@
|
|||||||
assert(editor == nil)
|
assert(editor == nil)
|
||||||
editor = { room_mode = false }
|
editor = {
|
||||||
|
room_mode = false,
|
||||||
|
palette_mode = false
|
||||||
|
}
|
||||||
|
|
||||||
function stepEditor()
|
function stepEditor()
|
||||||
palette = palette or false
|
editor.palette_mode = editor.palette_mode or false
|
||||||
animateTiles()
|
animateTiles()
|
||||||
if Keybind:checkPressed(Keybind.editor.room_mode) then
|
if Keybind:checkPressed(Keybind.editor.room_mode) then
|
||||||
if love.keyboard.isDown("lshift") then
|
if love.keyboard.isDown("lshift") then
|
||||||
@ -13,35 +16,61 @@ function stepEditor()
|
|||||||
editor.room_points = {}
|
editor.room_points = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
if Keybind:checkPressed(Keybind.editor.palette) then
|
if Keybind:checkPressed(Keybind.editor.palette_mode) then
|
||||||
if palette then
|
if editor.palette_mode then
|
||||||
palette = false
|
editor.palette_mode = false
|
||||||
palette_scroll_x = nil
|
palette_scroll_x = nil
|
||||||
palette_scroll_y = nil
|
palette_scroll_y = nil
|
||||||
else
|
else
|
||||||
palette = true
|
editor.palette_mode = true
|
||||||
|
palette_scroll_x = 0
|
||||||
|
palette_scroll_y = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if Keybind:checkPressed(Keybind.editor.palette_mode) then
|
||||||
|
if editor.palette_mode then
|
||||||
|
editor.palette_mode = false
|
||||||
|
palette_scroll_x = nil
|
||||||
|
palette_scroll_y = nil
|
||||||
|
else
|
||||||
|
editor.palette_mode = true
|
||||||
|
palette_scroll_x = 0
|
||||||
|
palette_scroll_y = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if Keybind:checkPressed(Keybind.editor.palette_mode) then
|
||||||
|
if editor.palette_mode then
|
||||||
|
editor.palette_mode = false
|
||||||
|
palette_scroll_x = nil
|
||||||
|
palette_scroll_y = nil
|
||||||
|
else
|
||||||
|
editor.palette_mode = true
|
||||||
palette_scroll_x = 0
|
palette_scroll_x = 0
|
||||||
palette_scroll_y = 0
|
palette_scroll_y = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO:
|
-- TODO:
|
||||||
|
-- i changed this but i dont know what was to do here.
|
||||||
if love.keyboard.isDown('a',"left") then
|
-- - made specific action keybinds
|
||||||
Camera.pos.x = Camera.pos.x - 3/game.scale
|
if Keybind:checkDown(Keybind.editor.left) then
|
||||||
|
Camera.pos.x = Camera.pos.x - 3
|
||||||
end
|
end
|
||||||
if love.keyboard.isDown('d',"right") then
|
if Keybind:checkDown(Keybind.editor.right) then
|
||||||
Camera.pos.x = Camera.pos.x + 3/game.scale
|
Camera.pos.x = Camera.pos.x + 3
|
||||||
end
|
end
|
||||||
if love.keyboard.isDown("up", "w") then
|
if Keybind:checkDown(Keybind.editor.up) then
|
||||||
Camera.pos.y = Camera.pos.y - 3/game.scale
|
Camera.pos.y = Camera.pos.y - 3
|
||||||
end
|
end
|
||||||
if love.keyboard.isDown("down", "s") then
|
if Keybind:checkDown(Keybind.editor.down) then
|
||||||
Camera.pos.y = Camera.pos.y + 3/game.scale
|
Camera.pos.y = Camera.pos.y + 3
|
||||||
end
|
end
|
||||||
|
|
||||||
if palette then
|
if editor.palette_mode then
|
||||||
if Keybind:checkPressed(Keybind.debug.debug) then
|
if Keybind:checkPressed(Keybind.editor.palette_change) then
|
||||||
local next = false
|
local next = false
|
||||||
local export = nil
|
local export = nil
|
||||||
for k, v in pairs(tileset) do
|
for k, v in pairs(tileset) do
|
||||||
@ -66,7 +95,7 @@ function stepEditor()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if Keybind:checkPressed(Keybind.debug.reload) then
|
if Keybind:checkPressed(Keybind.editor.save) then
|
||||||
Prompt:new({
|
Prompt:new({
|
||||||
name = "level name",
|
name = "level name",
|
||||||
input = "unnamed",
|
input = "unnamed",
|
||||||
@ -85,13 +114,13 @@ function stepEditor()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if Keybind:checkPressed(Keybind.debug.editor) then
|
if Keybind:checkPressed(Keybind.debug.editor) then
|
||||||
editor_mode = false
|
editor_mode = editor_mode
|
||||||
createTileObjects()
|
createTileObjects()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function scrollEditor(y)
|
function scrollEditor(y)
|
||||||
if palette then
|
if editor.palette_mode then
|
||||||
if love.keyboard.isDown("lshift") then
|
if love.keyboard.isDown("lshift") then
|
||||||
palette_scroll_y = palette_scroll_y + y
|
palette_scroll_y = palette_scroll_y + y
|
||||||
else
|
else
|
||||||
@ -114,7 +143,7 @@ function drawEditor()
|
|||||||
drawEditorRooms()
|
drawEditorRooms()
|
||||||
drawSelectingPaletteTile()
|
drawSelectingPaletteTile()
|
||||||
|
|
||||||
if palette then
|
if editor.palette_mode then
|
||||||
doEditorPalette()
|
doEditorPalette()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -171,7 +200,7 @@ function doEditorEdit()
|
|||||||
else
|
else
|
||||||
love.graphics.print("Select bottom right of new room", 0, 20)
|
love.graphics.print("Select bottom right of new room", 0, 20)
|
||||||
end
|
end
|
||||||
elseif not palette then
|
elseif not editor.palette_mode then
|
||||||
if LevelTiles[vertical] ~= nil
|
if LevelTiles[vertical] ~= nil
|
||||||
and LevelTiles[vertical][horizontal] ~= nil
|
and LevelTiles[vertical][horizontal] ~= nil
|
||||||
and love.keyboard.isDown("lshift") ~= true
|
and love.keyboard.isDown("lshift") ~= true
|
||||||
|
@ -112,10 +112,16 @@ function Keybind:default()
|
|||||||
Keybind.debug.playback = { keys = {"f6"}}
|
Keybind.debug.playback = { keys = {"f6"}}
|
||||||
|
|
||||||
-- Editor
|
-- Editor
|
||||||
Keybind.editor.palette = { keys = {"tab"}}
|
Keybind.editor.palette_mode = { keys = {"tab"}}
|
||||||
Keybind.editor.room_mode = { keys = {"r"}}
|
Keybind.editor.room_mode = { keys = {"r"}}
|
||||||
Keybind.editor.entity_mode = { keys = {"e"}}
|
Keybind.editor.entity_mode = { keys = {"e"}}
|
||||||
Keybind.editor.properties_mode = { keys = {"p"}}
|
Keybind.editor.properties_mode = { keys = {"p"}}
|
||||||
|
Keybind.editor.left = { keys = {"left", "a"}}
|
||||||
|
Keybind.editor.right = { keys = {"right", "d"}}
|
||||||
|
Keybind.editor.up = { keys = {"up", "w"}}
|
||||||
|
Keybind.editor.down = { keys = {"down", "s"}}
|
||||||
|
Keybind.editor.palette_change = { keys = {"f1"}}
|
||||||
|
Keybind.editor.save = { keys = {"f3"}}
|
||||||
|
|
||||||
-- Generic
|
-- Generic
|
||||||
Keybind.generic.lclick = { keys = {1}}
|
Keybind.generic.lclick = { keys = {1}}
|
||||||
|
Loading…
Reference in New Issue
Block a user