SoftLEASH game engine logo

WIKI

LUA / LÖVE

SOFTLEASH / DOCUMENTATION

Action Input

Describe what the player wants to do, rather than which key they pressed.

A working outline. The snippets below use plain LÖVE and Lua, not the final SoftLEASH API.

Overview

Action-based input separates a game action from a particular key or device. Movement, jumping, and interaction can be named once and mapped to the inputs that make sense for a player.


Add the actual action registration and binding API here. Cover held, pressed, and released states, and explain how keyboard and controller input fit together.


LÖVE example

A small, plain LÖVE example for the draft. Replace this snippet with the documented SoftLEASH API and a focused use case later.


local g = love.graphics
local keys = love.keyboard
local x = 100

function love.update(dt)
    if keys.isDown("left") then
        x = x - 160 * dt
    end
    if keys.isDown("right") then
        x = x + 160 * dt
    end
end

function love.draw()
    g.rectangle(
        "fill", x, 120, 24, 24
    )
end
local g = love.graphics
local keys = love.keyboard
local x = 100

function love.update(dt)
    if keys.isDown("left") then
        x = x - 160 * dt
    end
    if keys.isDown("right") then
        x = x + 160 * dt
    end
end

function love.draw()
    g.rectangle(
        "fill", x, 120, 24, 24
    )
end
local g = love.graphics
local keys = love.keyboard
local x = 100

function love.update(dt)
    if keys.isDown("left") then
        x = x - 160 * dt
    end
    if keys.isDown("right") then
        x = x + 160 * dt
    end
end

function love.draw()
    g.rectangle(
        "fill", x, 120, 24, 24
    )
end


What to document next

  • Declaring actions and their bindings.

  • Held, pressed, and released states.

  • Rebinding and multiple input devices.

SOFTLEASH / A GO DOG! TOOL

DOCUMENTATION IN PROGRESS

DOCUMENTATION IN PROGRESS