Skip to content

Instantly share code, notes, and snippets.

View Achie72's full-sized avatar
💻
Probably doing some game jam

Achie Game Dev Achie72

💻
Probably doing some game jam
View GitHub Profile
@Achie72
Achie72 / maploader.p8
Created January 7, 2026 19:11
Loading 8x8 maps for PICO-8
function load_map(index)
-- reset the won flag
won = false
--reset the map
for i=0,7 do
for j=0,7 do
mset(i,j,0)
end
end
-- we wan to copy the indexth map
@Achie72
Achie72 / letter_flood_fill.p8
Created January 5, 2026 19:36
Word Sokoban flood fill for the word
-- here these numbers are a bit weird, due to how i have my sprite sheet,
-- letters start at tile 16, so WIN spelled out with tile numbers is this
-- sequence trust me. W = 38, I = 24 etc...
sequence = {38,24,29}
won = false
function check_for_sequence(x,y,index)
-- the char matches the winning words char
if mget(x,y) == sequence[index] then
-- if this is the last char in
@Achie72
Achie72 / sokoban_pushing.p8
Created January 5, 2026 19:34
How to push sokoban boxes in PICO-8
function _init()
player = {
x=1,
y=1,
direction = 5
}
poke(0x5f2c,3)
end
directions = {
@Achie72
Achie72 / connect4.p8
Created December 18, 2025 12:41
Connect 4 Drop Code for PICO-8
-- I'm using sprite 1 and 2 for drawing, so draw something there
units = {}
cursor = {
x = 1,
y = 1
}
bottom_of_board = 9
is_green = true
@Achie72
Achie72 / mod-list.json
Created November 29, 2025 11:13
BOBA Factorio Playthrough modlist
{
"mods":
[
{
"name": "base",
"enabled": true
},
@Achie72
Achie72 / launch.json
Created November 29, 2025 10:35
launch.json for love2d on linux mint
{
"version": "0.2.0",
"configurations": [
{
"type": "lua-local",
"request": "launch",
"name": "Debug",
"program": {
"command": "love"
},
@Achie72
Achie72 / accumulator_update.lua
Created August 10, 2025 08:43
Accumulator trick for fix fps
function love.update(dt)
accumulator = accumulator+dt
if joystick then
handle_joystick(joystick)
end
if accumulator >= tickPeriod then
-- do update stuff
end
end
@Achie72
Achie72 / scaling_canvas.lua
Created August 10, 2025 08:40
Löve 2D canvas scaling
function love.draw()
local width, height = love.graphics.getDimensions()
local gameScale = canvasWidth / canvasHeight
local windowScale = width / height
local sw, sh = width/canvasWidth, height/canvasHeight
if windowScale > gameScale then
drawScale = sh
else
drawScale = sw
@Achie72
Achie72 / item_pool.p8
Created May 30, 2025 18:20
Having a pool of upcoming items
if btnp(4) then
local index = cursor.y*10+cursor.x
-- placing something will have to consider if it is an empty spot
-- and if we still have something to place (in hand is > 0 in id)
if (space_map[index] == vacant) and (in_hand_object != 0) then
-- if so place it
space_map[cursor.y*10+cursor.x] = in_hand_object
-- set our hand to "empty"
in_hand_object = 0
-- only add objecst to hand if we still have them in pool
@Achie72
Achie72 / daily_verse_grid.p8
Created May 30, 2025 18:14
Grid play area in Daily Verse
-- borders around play area
line(8,7,87,7,1)
line(7,8,7,88,1)
line(88,8,88,88,1)
line(8,89,87,89,1)
-- fill pattern for grid
for i=1,10 do
fillp(▒)
--line((i*8)-1,8,(i*8),88,1)
local xpos = (i*8)-1