demo recording and playback, collision table

This commit is contained in:
lustlion
2022-02-17 23:39:31 +01:00
parent fb375e352b
commit 8e9078e929
9 changed files with 1063 additions and 42 deletions

View File

@@ -1,19 +1,43 @@
Keybind = {}
Keybind.move = {}
Keybind.move.left = { demo = "move_left"}
Keybind.move.right = { demo = "move_right"}
Keybind.move.up = { demo = "move_up"}
Keybind.move.down = { demo = "move_down"}
Keybind.move.jump = { demo = "move_jump"}
Keybind.move.hook = { demo = "move_hook"}
Keybind.move.dash = { demo = "move_dash"}
Keybind.menu = {}
Keybind.menu.pause = { demo = "menu_pause"}
Keybind.menu.confirm = { demo = "menu_confirm"}
Keybind.debug = {}
Keybind.editor = {}
Keybind.generic = {}
function Keybind:CheckDown(action)
for _, keyname in pairs(action.keys) do
if type(keyname) == "string" then
if love.keyboard.isDown(keyname) then return true end
else
if love.mouse.isDown(keyname) then return true end
if DemoPlayback then
for _, demo_action in pairs(DemoAction[CurrentDemoFrame]) do
if demo_action == action.demo then
return true
end
end
return false
else
for _, keyname in pairs(action.keys) do
local fn = love.keyboard.isDown
if not type(keyname) == "string" then
local fn = love.mouse.isDown
end
if fn(keyname) then
Demo:RecordAction(action.demo)
return true
end
end
return false
end
return false
end
function Keybind:CheckPressed(action)
@@ -51,23 +75,25 @@ end
function Keybind:Default()
--Menu
Keybind.menu.pause= { keys = {"escape"}}
Keybind.menu.confirm= { keys = {"z", "space", 1}}
Keybind.menu.pause.keys = {"escape"}
Keybind.menu.confirm.keys = {"z", "space", 1}
--Move
Keybind.move.left = { keys = {"left", "a"}}
Keybind.move.right = { keys = {"right", "d"}}
Keybind.move.up = { keys = {"up", "w"}}
Keybind.move.down = { keys = {"down", "s"}}
Keybind.move.jump = { keys = {"z", "space"}}
Keybind.move.hook = { keys = {"x", 1}}
Keybind.move.dash = { keys = {"c", 2}}
Keybind.move.left.keys = {"left", "a"}
Keybind.move.right.keys = {"right", "d"}
Keybind.move.up.keys = {"up", "w"}
Keybind.move.down.keys = {"down", "s"}
Keybind.move.jump.keys = {"z", "space"}
Keybind.move.hook.keys = {"x", 1}
Keybind.move.dash.keys = {"c", 2}
--Debug
Keybind.debug.debug = { keys = {"f1"}}
Keybind.debug.reposition = { keys = {"f2"}}
Keybind.debug.reload = { keys = {"f3"}}
Keybind.debug.editor = { keys = {"f4"}}
Keybind.debug.recording = { keys = {"f5"}}
Keybind.debug.playback = { keys = {"f6"}}
-- Editor
Keybind.editor.palette = { keys = {"tab"}}