experiments-pico8/games/improv.p8

101 lines
5.1 KiB
Plaintext
Raw Permalink Normal View History

2023-03-08 01:29:31 +00:00
pico-8 cartridge // http://www.pico-8.com
version 41
__lua__
-- letter select
letters = {
"a", "b", "c", "d", "e", "f",
"g", "h", "i", "j", "k", "l",
"m", "n", "o", "p", "q", "r",
"s", "t", "u", "v", "w", "x",
"y", "z", "_", "<", "★"
}
lsel = {
pos = 1,
row_w = 13,
word = ""
}
function _draw()
cls()
lsel:draw(10, 10)
end
function _update()
lsel:update()
end
function lsel:update()
if btnp(⬅️) then
self.pos -= 1
elseif btnp(➡️) then
self.pos += 1
elseif btnp(⬇️) then
self.pos += self.row_w
elseif btnp(⬆️) then
self.pos -= self.row_w
elseif btnp(🅾️) then
letter = letters[self.pos]
if letter == "_" then
self.word = self.word.." "
elseif letter == "<" then
self.word = sub(self.word, 0, #self.word-1)
else
self.word = self.word..letter
end
end
end
function lsel:draw(x, y)
local cx = x
for i,l in pairs(letters) do
if i == lsel.pos then
print(l, cx, y, 7)
rect(cx-2, y-2, cx+4, y+6, 10)
else
print(l, cx, y, 1)
end
cx += 8
if i>0 and i%self.row_w==0 then
y += 8
cx = x
end
end
print(self.word)
end
__gfx__
00000000000000bbbbb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000bbcccccbb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000bcccccccccb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
8000000000bccc88888cccb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
c80000000bccc8000008cccb00000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
cc8000000bcc800000008ccb0000008c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
ccc800000bcc800000008ccb000008cc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
cccc80000bcc800000008ccb00008ccc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
bcccc8000bccc8000008cccb0008cccc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0bcccc8000bccc88888cccb0008ccccb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00bcccc8000bcccccccccb0008ccccb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000bcccc8000bbcccccbb0008ccccb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000bcccc80000bbbbb00008ccccb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000bcccc8000000000008ccccb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000bcccc80000000008ccccb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000bcccc800000008ccccb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000bcccc8000008ccccb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000bccc8000008cccb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000bcc8000008ccb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000bcc8000008ccb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000bcc8000008ccb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000bcc8000008ccb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000bcc8000008ccb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000bcc8000008ccb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000bcc8000008ccb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000bcc8000008ccb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000bcc8000008ccb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000bcc8000008ccb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000bcc8000008ccb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000bcc8000008ccb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000bcc8000008ccb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000bcc8000008ccb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000