You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
136 lines
6.9 KiB
136 lines
6.9 KiB
pico-8 cartridge // http://www.pico-8.com
|
|
version 32
|
|
__lua__
|
|
-- game code
|
|
|
|
function init_world()
|
|
player = {}
|
|
player.x = 60
|
|
player.y = 112
|
|
player.vy = 0
|
|
player.flipx = false
|
|
player.spr = 0
|
|
player.moves = 0
|
|
end
|
|
|
|
function _init()
|
|
palt(black, false)
|
|
palt(peach, true)
|
|
init_world()
|
|
end
|
|
|
|
function _update()
|
|
update_player()
|
|
end
|
|
|
|
function _draw()
|
|
cls(12)
|
|
draw_bg()
|
|
draw_player()
|
|
print_ctr("b o r b",8,yellow)
|
|
end
|
|
|
|
function draw_bg()
|
|
for i=0,15 do
|
|
spr(64,i*8,120)
|
|
end
|
|
end
|
|
|
|
function update_player()
|
|
if (btn(0)) then
|
|
player.x -= 1
|
|
player.moves += 1
|
|
player.flipx = true
|
|
end
|
|
if (btn(1)) then
|
|
player.x += 1
|
|
player.moves += 1
|
|
player.flipx = false
|
|
end
|
|
if (btnp(🅾️) and not player.jumping) then
|
|
player.vy = -6
|
|
player.jumping = true
|
|
end
|
|
player.y += player.vy
|
|
player.vy += 0.5
|
|
if (player.y > 112) then
|
|
player.y = 112
|
|
player.vy = 0
|
|
player.jumping = false
|
|
end
|
|
player.spr = (player.moves / 3) % 3
|
|
if (player.x < 0) player.x = 0
|
|
if (player.x > 120) player.x = 120
|
|
end
|
|
|
|
function draw_player()
|
|
spr(player.spr,player.x,player.y,1,1,player.flipx)
|
|
end
|
|
|
|
-->8
|
|
-- library
|
|
|
|
black = 0
|
|
dark_blue = 1
|
|
dark_purple = 2
|
|
dark_green = 3
|
|
brown = 4
|
|
dark_gray = 5
|
|
light_gray = 6
|
|
white = 7
|
|
red = 8
|
|
orange = 9
|
|
yellow = 10
|
|
green = 11
|
|
blue = 12
|
|
indigo = 13
|
|
pink = 14
|
|
peach = 15
|
|
|
|
function print_ctr(s,y,c)
|
|
print(s,64 - #s * 2,y,c)
|
|
end
|
|
__gfx__
|
|
ffff00ffffff00ffffff00ff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
fff0880ffff0880ffff0880f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
ffff800fffff800fffff800f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
fff0800800008008fff0800800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
ff08888ff888888fff08888f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
f088888fff88888ff088888f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
088888fffff888ff088888ff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
fff4f4fffff4f4ffff4f4fff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
44444444000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
44444444000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
14444441000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
11144111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
11111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
11111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
11111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
11111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
__gff__
|
|
0000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|