SoftLEASH game engine logo

WIKI

LUA / LÖVE

SOFTLEASH / DOCUMENTATION

Collision System

Describe shapes, detect contact, and decide how objects should respond.

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

Overview

A collision system brings shapes and contact queries together. Detection answers whether objects touch; gameplay code decides what that contact means.


Use this page for supported shapes, collision layers, queries, and response behavior. The example shows a simple rectangle test using ordinary Lua, not the engine’s final collision interface.


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 mouse = love.mouse

function love.draw()
    local x,y = mouse.getPosition()
    local hit = x < 240
        and x + 24 > 120
        and y < 200
        and y + 24 > 100
    if hit then
        g.setColor(1, 0.77, 0.15)
    else
        g.setColor(0.3, 0.61, 0.9)
    end
    g.rectangle(
        "fill", 120, 100, 120, 100
    )
    g.rectangle(
        "line", x, y, 24, 24
    )
end
local g = love.graphics
local mouse = love.mouse

function love.draw()
    local x,y = mouse.getPosition()
    local hit = x < 240
        and x + 24 > 120
        and y < 200
        and y + 24 > 100
    if hit then
        g.setColor(1, 0.77, 0.15)
    else
        g.setColor(0.3, 0.61, 0.9)
    end
    g.rectangle(
        "fill", 120, 100, 120, 100
    )
    g.rectangle(
        "line", x, y, 24, 24
    )
end
local g = love.graphics
local mouse = love.mouse

function love.draw()
    local x,y = mouse.getPosition()
    local hit = x < 240
        and x + 24 > 120
        and y < 200
        and y + 24 > 100
    if hit then
        g.setColor(1, 0.77, 0.15)
    else
        g.setColor(0.3, 0.61, 0.9)
    end
    g.rectangle(
        "fill", 120, 100, 120, 100
    )
    g.rectangle(
        "line", x, y, 24, 24
    )
end


What to document next

  • Supported shapes and collision layers.

  • Contact callbacks and overlap queries.

  • Detection versus physical response.

SOFTLEASH / A GO DOG! TOOL

DOCUMENTATION IN PROGRESS

DOCUMENTATION IN PROGRESS