Skip to content

Instantly share code, notes, and snippets.

@inajob
Created October 21, 2018 07:40
Show Gist options
  • Save inajob/6e5aa6590a3773d3e597303548f1c052 to your computer and use it in GitHub Desktop.
Save inajob/6e5aa6590a3773d3e597303548f1c052 to your computer and use it in GitHub Desktop.
o-bako用ドット絵エディタ
function cls()
color(0,0,0)
fillrect(0,0,128,128)
end
function setup()
cls()
end
digit = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
}
px = 0
py = 0
function loop()
if btn(0) == 2 and px > 0 then
px = px - 1
end
if btn(1) == 2 and px < 15 then
px = px + 1
end
if btn(2) == 2 and py > 0 then
py = py - 1
end
if btn(3) == 2 and py < 15 then
py = py + 1
end
if btn(5) > 0 then
digit[py * 16 + px + 1] = 1
end
if btn(6) > 0 then
digit[py * 16 + px + 1] = 0
end
cls()
color(255,255,255)
for i = 0, 15 do
drawrect(0, i * 16,128,16)
drawrect(i * 16, 0,16, 128)
end
for y = 0, 16 do
for x = 0, 16 do
if digit[y*16+x + 1] == 1 then
fillrect(x * 8, y * 8, 8, 8)
end
end
end
color(0,255,0)
drawrect(px*8, py*8 ,8, 8)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment