SoftLEASH game engine logo

WIKI

LUA / LÖVE

SOFTLEASH / DOCUMENTATION

Timers

Schedule small pieces of work without hiding time inside your game logic.

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

Overview

Timers are useful for cooldowns, delayed actions, and repeating gameplay beats. Keeping time-based work explicit makes it easier to pause, cancel, and understand.


Use this page to describe timer creation, repetition, cancellation, and ownership. This placeholder measures elapsed time directly through LÖVE’s update callback.


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 elapsed, ticks = 0, 0

function love.update(dt)
    elapsed = elapsed + dt
    while elapsed >= 1 do
        elapsed = elapsed - 1
        ticks = ticks + 1
    end
end

function love.draw()
    love.graphics.print(
        "Seconds: " .. ticks, 32, 32
    )
end
local elapsed, ticks = 0, 0

function love.update(dt)
    elapsed = elapsed + dt
    while elapsed >= 1 do
        elapsed = elapsed - 1
        ticks = ticks + 1
    end
end

function love.draw()
    love.graphics.print(
        "Seconds: " .. ticks, 32, 32
    )
end
local elapsed, ticks = 0, 0

function love.update(dt)
    elapsed = elapsed + dt
    while elapsed >= 1 do
        elapsed = elapsed - 1
        ticks = ticks + 1
    end
end

function love.draw()
    love.graphics.print(
        "Seconds: " .. ticks, 32, 32
    )
end


What to document next

  • One-shot and repeating timers.

  • Cancellation and ownership.

  • Pause behavior and time scale.

SOFTLEASH / A GO DOG! TOOL

DOCUMENTATION IN PROGRESS

DOCUMENTATION IN PROGRESS