add map and camera

This commit is contained in:
Colin McMillen 2021-07-08 15:14:21 -04:00
parent 273f307375
commit 79e820e247

60
borb.p8
View File

@ -31,15 +31,16 @@ end
function _draw() function _draw()
cls(12) cls(12)
camera_x = mid(0, 896, player.x - 64)
camera(camera_x, 0)
draw_bg() draw_bg()
draw_player() draw_player()
camera(0, 0)
print_ctr("b o r b",8,yellow) print_ctr("b o r b",8,yellow)
end end
function draw_bg() function draw_bg()
for i=0,15 do map(0, 0, 0, 0, 128, 16)
spr(64,i*8,120)
end
end end
function update_player() function update_player()
@ -64,9 +65,9 @@ function update_player()
player.vy = 0 player.vy = 0
player.jumping = false player.jumping = false
end end
player.spr = (player.moves / 3) % 3 player.spr = (player.moves / 3) % 3 + 1
if (player.x < 0) player.x = 0 if (player.x < 0) player.x = 0
if (player.x > 120) player.x = 120 if (player.x > 1016) player.x = 1016
end end
function draw_player() function draw_player()
@ -97,14 +98,14 @@ function print_ctr(s,y,c)
print(s,64 - #s * 2,y,c) print(s,64 - #s * 2,y,c)
end end
__gfx__ __gfx__
ffff00ffffff00ffffff00ff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000ffff00ffffff00ffffff00ff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
fff0880ffff0880ffff0880f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000fff0880ffff0880ffff0880f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
ffff800fffff800fffff800f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000ffff800fffff800fffff800f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
fff0800800008008fff0800800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000fff0800800008008fff08008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
ff08888ff888888fff08888f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000ff08888ff888888fff08888f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
f088888fff88888ff088888f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000f088888fff88888ff088888f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
088888fffff888ff088888ff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000088888fffff888ff088888ff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
fff4f4fffff4f4ffff4f4fff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000fff4f4fffff4f4ffff4f4fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
@ -129,14 +130,31 @@ fff4f4fffff4f4ffff4f4fff00000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
44444444000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 44444444444444440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
44444444000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 44444444444444440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
14444441000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 14444441444444110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
11144111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 11144111114411110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
11111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 11111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
11111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 11111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
11111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 11111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
11111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 11111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
__gff__ __gff__
0000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
__map__
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
4040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040