Skip to content

Instantly share code, notes, and snippets.

View EngineerSmith's full-sized avatar
🔧
🦆

Engineer Smith EngineerSmith

🔧
🦆
View GitHub Profile

Love Jam 2024

Theme: Interface

Core Mechanics

Limb Removal and Grafting

  • Players can freely remove and attach limbs to themselves or their partner. Different limbs offer unique abilities:
    • Legs: Standard movement speed, jumping, climbing.
    • Arms: Grabbing objects, manipulating switches, throwing limbs.
    • Heads: Special abilities. (?)
@EngineerSmith
EngineerSmith / main.lua
Last active February 14, 2024 20:33
Adds color back into text wrapped by font:getWrap
getWrapColored = function(font, text, limit)
local width, wrappedText = font:getWrap(text, limit)
local wrappedTextColored, textIndex = { }, 1
local currentColoredText, color = text[textIndex+1], text[textIndex]
for i, line in ipairs(wrappedText) do -- for each line
wrappedTextColored[i] = { }
while true do
-- if line fits within the current color string
if #line <= #currentColoredText then
table.insert(wrappedTextColored[i], color)
local dict = {
"commonly",
"used",
"strings", -- these strings, are not just values but keys too in a table!
}
-- send dict to client from server, so they are in sync and can decode the messages
local buffer = require("string.buffer)"
local data = buffer.encode(dict) -- send string to client, and do buffer.decode on it, so it can use it same as the server
-- recive dict, or already has dict if the server
@EngineerSmith
EngineerSmith / button.lua
Created July 8, 2022 12:12
Modules for android buttons - doesn't handle scaling for you; you can add that
local input = require("input")
local button = { }
button.__index = button
button.new = function(x, y, w, h)
return setmetatable({ x = x, y = y, w = w, h = h}, button)
end
button.setTapCallback = function(self, callback, ...)
-- Copyright 2015 Paul Kulchenko, ZeroBrane LLC; All rights reserved
local updateneeded
local indicator = 12
return {
name = "Highlight selected",
description = "Highlights all instances of a selected word.",
author = "Paul Kulchenko",
version = 0.11,
dependencies = 0.71,
@EngineerSmith
EngineerSmith / utf8substring.lua
Created April 9, 2022 19:29
utf8 substring by index five
local utf8 = require("utf8")
local utf8pos, utf8len = utf8.offset, utf8.len
local sub = string.sub
local max, min = math.max, math.min
local posrelat = function(pos, len)
if pos >= 0 then return pos end
if -pos > len then return 0 end
return pos + len + 1
end
appleCake.setBuffer(true)
local profile
function love.update(dt)
profile = appleCake.profileFunc(nil, profile)
-- ...
profile:stop() -- buffered, not sent to be saved
end
function love.draw()
appleCake.flush()
appleCake.setBuffer(false) -- default
appleCake.setBuffer(true)
-- Once true
appleCake.flush()
-- must be manually called for data to be pushed to the file saving thread
local jprof = appleCake.jprof
jprof.enabled(true)
jprof.enabled(false)