Here is a series of functions that are designed to be easily inserted into any project!
Each should be well commented and has a working example. comment if you have any questions!
add a mouse function quickly!
move towards a target with a normalized speed (diagonals are not faster!)
updated gpio library for (significantly) less tokens. now available for commercial use.
enter the pin (0 to 127) and return the hex (0x5f80 to 0x5fff) with get and set functions
old version included for posterity
covers rect collisions and map flags; circ collisions are in lookatlib
grid based path finding using A*
credit to https://www.lexaloffle.com/bbs/?tid=3131 and Pico8 Fanzine #4!

This is the finished version of the original game made for the Extra Credits game jam #6 "Take Care."
jam edition: https://dmandy.itch.io/dangerous-alone
This is a game tribute to the prince of Fife.
It fall under the fan art category. While technically this cart has no actual references to the band, do not distribute this for money, Angus is their i.p.!
Someday:
He will quest for the jet pack and gain a dash ability.
- this will include a laser dragon boss battle!
Then he will recharge his hammer in the sun and gain the smash ability.
- this will include a Death Knight boss battle!
There may be 8bit heavy metal music!
I could easily find a tutorial on how to make a bounding box collision function online, but I could not easily find an example of iterating through a table to test for collisions, so I made it myself in hopes to help new programmers.
-- collision example
-- andy c
function _init()
-- create player object named block, each object in this example will need an x and a y
block = {}
block.x = 64
block.y = 64
-- create 6 walls
walla = {}
walla.x = ceil(rnd(120))
walla.y = ceil(rnd(120))
wallb = {}
wallb.x = ceil(rnd(120))
wallb.y = ceil(rnd(120))
wallc = {}
wallc.x = ceil(rnd(120))
wallc.y = ceil(rnd(120))
walld = {}
walld.x = ceil(rnd(120))
walld.y = ceil(rnd(120))
walle = {}
walle.x = ceil(rnd(120))
walle.y = ceil(rnd(120))
wallf = {}
wallf.x = ceil(rnd(120))
wallf.y = ceil(rnd(120))
-- add the walls to the wall table
walls = {walla, wallb, wallc, walld, walle, wallf}
-- here's an inspirational quote: "wall-e" - wall-e
end
function collision(wall)
-- basically if it overlaps on two axis, it's a collision
if(block.x < wall.x + 8 and
block.x + 8 > wall.x and
block.y < wall.y + 8 and
block.y + 8 > wall.y)then
return true
end
end
function _update()
-- basically, move the coordinate, and test a collision for every object in the table.
-- if any of them return true, move back the coordinate to where it was
-- left
if (btn(0) and block.x > 0) then
block.x -= 1
for i in all(walls) do
if (collision(i)) then
block.x += 1
end
end
end
-- right
if (btn(1) and block.x < 120) then
block.x += 1
for i in all(walls) do
if (collision(i)) then
block.x -= 1
end
end
end
-- up
if (btn(2) and block.y > 0) then
block.y -= 1
for i in all(walls) do
if (collision(i)) then
block.y += 1
end
end
end
-- down
if (btn(3) and block.y < 120) then
block.y += 1
for i in all(walls) do
if (collision(i)) then
block.y -= 1
end
end
end
end
function _draw()
-- iterate through the table and draw a blue square for each block. draw a red square for the player
cls()
spr(1,block.x,block.y)
for i in all(walls) do
spr(2,i.x,i.y)
end
end |





2 comments












