SoftLEASH game engine logo

WIKI

LUA / LÖVE

SOFTLEASH / DOCUMENTATION

Animated Sprite

Turn a sequence of frames into a readable animation state.

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

Overview

An animated sprite connects frame data, playback timing, and the current animation. It should be easy to see which animation is active and how its playback progresses.


Add sprite-sheet layout, frame timing, animation switching, and completion behavior here. This asset-free placeholder changes a drawn shape over time to demonstrate a frame clock.


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 clock, frame = 0, 1

function love.update(dt)
    clock = clock + dt
    frame = math.floor(clock * 6)
    frame = frame % 4 + 1
end

function love.draw()
    g.rectangle(
        "fill", 80, 80,
        16 * frame, 32
    )
    g.print(
        "Frame " .. frame, 80, 128
    )
end
local g = love.graphics
local clock, frame = 0, 1

function love.update(dt)
    clock = clock + dt
    frame = math.floor(clock * 6)
    frame = frame % 4 + 1
end

function love.draw()
    g.rectangle(
        "fill", 80, 80,
        16 * frame, 32
    )
    g.print(
        "Frame " .. frame, 80, 128
    )
end
local g = love.graphics
local clock, frame = 0, 1

function love.update(dt)
    clock = clock + dt
    frame = math.floor(clock * 6)
    frame = frame % 4 + 1
end

function love.draw()
    g.rectangle(
        "fill", 80, 80,
        16 * frame, 32
    )
    g.print(
        "Frame " .. frame, 80, 128
    )
end


What to document next

  • Sprite sheets, frame sizes, and origins.

  • Looping, playback speed, and animation changes.

  • Completion events and drawing offsets.

SOFTLEASH / A GO DOG! TOOL

DOCUMENTATION IN PROGRESS

DOCUMENTATION IN PROGRESS