I fully believe that great art comes from working creatively within limitations, especially well-chosen self-imposed limitations.
That is part of the appeal of the beautifully simple, yet powerful, Pico-8 created by Lexaloffle.
🎮 Introduction to Pico-8 — Are.na
Inspired by my recent motorcycle journeys I wanted to try to capture some of the essence and joy of riding a motorcycle into a little video game poem.
My brother who is exceptionally talented at making sprites and composing music with trackers (a type of DAW for super-dorks) helped it come together. Coach Artie did most of the fancy coding.
pico-8 cartridge // http://www.pico-8.com
version 41
__lua__
local motorcycle = 0
local x = 64
local y = 90
local spd = 0
local lines = {}
local t = 0
local amplitude = 40
local frequency = 0.003
local padding = 8
local debug_mode = true
local offsetY = 0
local moveAmt = 0
local momentum = 0
local friction = 0.25
local ratioLimit = 300
local mph = 0
-- Initialize lines
for i = 1, 32 do
lines[i] = { width = 33 + (1.5 * sin(i/32 * 2 * 3.14)) }
end
function spd_to_mph(spd)
return flr(spd * 33)
end
local music_pattern = -1
-- music(music_pattern)
function _update()
t += spd
mph = spd_to_mph(spd)
momentum = momentum * friction
local lastMoveAmt = moveAmt
if btn(0) then
moveAmt = max(lastMoveAmt - 0.25*spd, -4)
elseif btn(1) then
moveAmt = min(lastMoveAmt + 0.25*spd, 4)
end
x = max(0, min(128, x +moveAmt+momentum*spd))
-- if mph is 0, then remove all momentum
if mph == 0 then
momentum = 0
moveAmt = 0
end
-- Apply momentum if no button is pressed.
if btn(2) then
spd = min(spd + 0.01, 10)
moveAmt = min(moveAmt + 0.01, 4)
if mph > 100 then
amplitude = max(amplitude - 1, 0)
frequency = min(frequency + 0.00001, 0.1)
end
else
momentum = moveAmt
end
if btn(3) then
spd = max(spd - 0.025, 0)
moveAmt = max(moveAmt - 0.05, 0.25)
amplitude = min(amplitude + 1, 40)
frequency = max(frequency - 0.00001, 0.002)
end
offsetY = (offsetY + spd) % #lines
if music_pattern == -1 and mph > 2 then
music_pattern = 0
music(music_pattern)
elseif music_pattern == 0 and mph < 2 then
music_pattern = -1
music(music_pattern)
elseif music_pattern == 0 and mph > 35 then
music_pattern = 1
music(music_pattern)
elseif music_pattern == 1 and mph > 70 then
music_pattern = 3
music(music_pattern)
elseif music_pattern == 3 and mph > 85 then
music_pattern = 4
music(music_pattern)
-- and if we reduce speed to 70, go back to pattern 1
elseif music_pattern == 4 and mph < 70 then
music_pattern = 1
music(music_pattern)
-- and if we reduce speed to 35, go back to pattern 0
elseif music_pattern == 3 and mph < 35 then
music_pattern = 0
music(music_pattern)
-- and if we reduce speed to 2, go back to pattern -1
elseif music_pattern == 4 and mph < 2 then
music_pattern = -1
music(music_pattern)
end
end
function _draw()
cls()
-- fill the whole screen with color 3
rectfill(0, 0, 128, 128, 3)
for i=1,#lines do
local lnIdx=(i+flr(offsetY))%#lines+1
local ln=lines[lnIdx]
local sway=amplitude*sin(frequency*t)
if mph > 100 then
sway+=amplitude*sin(perlin(i*t*0.1,t*0.1))
end
local left=max(0,64-ln.width/2+sway)
local right=min(128,64+ln.width/2+sway)
local y = (i - 1) * 8 - (offsetY % 1) * 8
local col = i + 1
rectfill( left, y, right, y + 8, 5)
-- crash detection
local motorcycleWidth = 16
local motorcycleHeight = 16
if x < left - motorcycleWidth or x > right + motorcycleWidth then
-- print("Crashing!", 64, 64, 9)
-- print crashing in a random color and location
print("Crashing!", rnd(128), rnd(128), rnd(16))
-- stop music
music(-1)
sfx(8)
-- else put the music back to where it was
if music_pattern ~= -1 then
music(music_pattern)
end
end
end
spr(motorcycle, x, y, 2, 2)
print(mph .. " mph", 92, 5, 7)
end
function perlin(x, y)local X,Y=flr(x),flr(y)local A,B,C,D=pget(X,Y),pget(X+1,Y),pget(X,Y+1),pget(X+1,Y+1)local u,v=x-X,y-Y
local function lerp(a,b,t)
return a*(1-t)+b*t end
local function fade(t)
return t*t*t*(t*(t*6-15)+10) end
local function grad(h,x,y)
local u=h%8
local v=h%16//8
u=1-u
v=1-v
return(u-v)*(1-x-y)+v*(1-x)+u*(1-y)-1 end
local nx,ny=fade(u),fade(v)local x1=lerp(grad(A,u,v),grad(B,u-1,v),nx)
local x2=lerp(grad(C,u,v-1),grad(D,u-1,v-1),nx)return lerp(x1,x2,ny)end
__gfx__
0000000000000000cccccccccccccccccccccccccccccccc00000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000cccccccccccccccccccccccccccccccc00000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000cccccccccccccccccccccccccccccccc00000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000220000000cccccccccccccccccccccccccccccccc00000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000ff0000000ccccccccccccccccc3333333cccccccc00000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000990000000ccccccccccc3333333333333333ccccc00000000000000000000000000000000000000000000000000000000000000000000000000000000
000f66999966f000ccccccc33333333333333333333ccccc00000000000000000000000000000000000000000000000000000000000000000000000000000000
0000996996990000ccccc333333333333333333333333ccc00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000c5555c00000ccccc3333333333333333333333333cc00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000c6666c00000cccc333333333333333333333333333c00000000000000000000000000000000000000000000000000000000000000000000000000000000
0000066116600000ccc3333333333333333333333333333c00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000461164400003333333333333333333333333333333300000000000000000000000000000000000000000000000000000000000000000000000000000000
00000001100000003333333333333333333333333333333300000000000000000000000000000000000000000000000000000000000000000000000000000000
00000001100000003333333333333333333333333333333300000000000000000000000000000000000000000000000000000000000000000000000000000000
00000001100000003333333333333333333333333333333300000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000aa00000003333333333333333333333333333333300000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000aa00000003333333333333333333333333333333300000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000003333333333333333333333333333333300000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000aa00000003333333333333333333333333333333300000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000aa00000003333333333333333333333333333333300000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000aa00000003333333333333333333333333333333300000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000003333333333333333333333333333333300000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000003333333333333333333333333333333300000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000aa00000003333333333333333333333333333333300000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000aa00000003333333333333333333333333333333300000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000aa00000003333333333333333333333333333333300000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000aa00000003333333333333333333333333333333300000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000003333333333333333333333333333333300000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000003333333333333333333333333333333300000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000003333333333333333333333333333333300000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000003333333333333333333333333333333300000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000003333333333333333333333333333333300000000000000000000000000000000000000000000000000000000000000000000000000000000
__sfx__
000100003c0500000037050000000000000000000000000000000000000000000000000003305033050300502d05029050240501f0501b05018050140500e0500a05006050040500305001050000000000000000
000800000000006250022500625002250016000160001600026000260002600026000260000600006000160001600016000160000600006000000000000000000000000000000000000000000000000000000000
000f00001923000000000000000023643000001e2401924000000192400000020230192400000020240000002324000000000000000023653000001e64323250000002f250000002a2602f270001002a27000000
000f0000236330000000000000000000000000000000c073236330c073000000000023653000000000000000236330000000000000000000000000000000c073236530c073000000000023633000000000000000
000f00000d3171032714337173370d347103171433717337193471c3472031723327193471c35720327233372f357273572a3272e3372f357273572a3272e3173b32733337363573a3673b33733357363673a377
000f00001b4410000018441000001b1501c1501e150201501e1501c1501b150171501703017010144402a44024441000000000000000244412b44100000273502723027020270102335023230230201e3501e230
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000165008650086500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
__music__
02 02434544
03 02434444
03 02034444
03 02030445
03 02030405
#pico8