BrownCode is a simplistic programming language inspired by Axe Parser, a programming language for the TI-83/84 series of graphing calculators. It includes easy graphical primitive and shape drawing, and a pseudo data/code section like a compiled binary. A detailed explanation of how the language is set up and how to use it is available here.
Random lines program
"Don't hit the sides of the tunnel" game
Drawing with chromatic tail
Source code for the "Don't hit the sides of the tunnel" game.
.DATA
tunnel_offsets:
zeros 64
tunnel_widths:
zeros 64
you_died:
0b10101110
0b10100110
0b01011101
0b10000000
0b01001010
0b10100101
0b01011001
0b01000000
0b01001110
0b11100110
0b01011101
0b10000000
.CODE
10 -> current_offset
80 -> current_width
0 -> counter
50 -> player_x
loop:
drawcolor(0)
clear()
if keypressed(4); player_x - 1 -> player_x; end
if keypressed(7); player_x + 1 -> player_x; end
draw_tunnel()
if (player_x < [&tunnel_offsets + 63] | player_x >= [&tunnel_offsets + 63] + [&tunnel_widths + 63]) & (counter > 63)
goto death_screen
end
drawcolor(0x0000D0FF)
pixel(player_x, 63)
advance_tunnel()
present()
delay(20)
pollexit()
goto loop
death_screen:
createmonosprite(&you_died, 32, 3, 0xFF0000FF) -> you_died_idx
drawcolor(0)
clear()
sprite(you_died_idx, 10, 10)
present()
death_loop:
delay(10)
pollexit()
goto death_loop
func draw_tunnel()
for i, 0, 64
[&tunnel_offsets + i] -> offset
[&tunnel_widths + i] -> width
drawcolor(0xFFFFFFFF)
line(offset, i, offset + width, i)
end
end
func advance_tunnel()
randomrange(0, 3) -> rand
if rand = 0 & current_offset > 0;
current_offset-1 -> current_offset
end
if rand = 1 & current_offset + current_width < 95
current_offset+1 -> current_offset
end
current_offset -> [&tunnel_offsets]
for i, 1, 64
64 - i -> j
// j = [63, 1]
[&tunnel_offsets + j - 1] -> [&tunnel_offsets + j]
[&tunnel_widths + j - 1] -> [&tunnel_widths + j]
end
counter + 1 -> counter
if counter % 10 = 0
current_width - 1 -> current_width
end
current_width -> [&tunnel_widths]
end