diff --git a/toomgis.p8 b/toomgis.p8 index f075a81..4ffcea1 100644 --- a/toomgis.p8 +++ b/toomgis.p8 @@ -12,6 +12,7 @@ function _update() --ampm_upd() --toomgis_upd() --level_draw() + level_upd() end function test_draw() @@ -108,11 +109,10 @@ function full() end end -full() function toomgis_draw(x, y) --sprm(32, x, y+12, 1, 2) - for i=0,#tbody do + for i=1,#tbody do -- rotate drawing order local bs = tbody[(i+flr(th)) % #tbody + 1] spr(bs.n, @@ -130,42 +130,87 @@ end -- level levels = { + {name="store aisle", + sky=7, + gnd=5, + mapy=2 + }, {name="city nights", sky=2, - gnd=5 + gnd=5, + mapy=5 } } lvl = levels[1] - +zoom = 16 horizon = 64 - -function bg_draw(sky_c, ground_c) - rectfill(0, 0, 128, horizon, lvl.sky) - rectfill(0, horizon, 128, 128, lvl.gnd) -end +px = 0 +py = 0 +vx = 0 +vy = 0 +yacc = 0 function level_draw() - bg_draw(2, 5) -- background + --rectfill(0, 0, 128, horizon, lvl.sky) + --rectfill(0, horizon, 128, 128, lvl.gnd) - map(0, 17, 0, 32, 16, 8) + --map(0, lvl.y, 0, 32, 16, 8) + -- each level is 3tl/24px + local h=24 * zoom + for y=0,h do + tline(0, 128-h+y, 128, 128-h+y, + 0, 2+y/(8*zoom), 1/(8*zoom), 0) + end - toomgis_draw(10, 96) - --for x=0,16 do - -- spr(130, x*8, 50) - --end + toomgis_draw(10, 96-py) + + -- debug + print(px..", "..py, 0, 0, 12) +end + +function level_upd() + if btn(➡️) then + vx += 0.1 + end + if btn(⬅️) then + vx -= 0.05 + end + if vx < 0 then + vx = 0 + elseif vx > 5 then + vx = 5 + end + if btn(❎) and py==0 then + yacc = 3 + end + + px += vx + py = max(0, py+vy) + vy += yacc + yacc -= 0.3 + + -- debug, zoom ctls + if btn(⬆️) then + zoom += 0.1 + elseif btn(⬇️) then + zoom -= 0.1 + end + if zoom < .5 then + zoom = .5 + end end __gfx__ 000022220000000000444400000ee000aaaaaaaa0000000000555500045454000099990000087000000000000cccccc00077700000000a0000ffff0000005555 000222220000000004eee440009ea9000aa77aa0060000000088880004545400099999900007400009f9f9f0cc1111cc06444660000a0a000fff4ff000055555 00224444000000004e444e44009ae9000aa778a000666600008ff800055555000aaaa8a00044470099999999c1111f1c064446660a0aaaa0ff4ff4ff00055555 00224554000000004e4004e4009aa9000a8888a00088880000ffff0004545400088aaaa000477700aaaaaaaac1f1ff1c0644460600aaaa004fffffff00099999 -00225074000000004e4004e4009ae9000a877aa00087870000f44f0004545400008aa80000ffff004a444a44c1ff111c0644466600888880fff4ff4f00099999 +00225c74000000004e4004e4009ae9000a877aa00087870000f44f0004545400008aa80000ffff004a444a44c1ff111c0644466600888880fff4ff4f00099999 022247440000000044e444e4009ea9000aaaaaa000787800008ff8000555550000aa880000ffff00bbb88abbc1fff11c0644466000899880f4ffffff00997799 0222244400000000044eee40009ae9000aaaaaa0008787000088880004545400000aa000000ff00099998999cc1111cc06644600008989800ff4f4f000977779 -022224000000000000444400000ee00000aaaa000088880000088000045454000008a000000ff000099999900cccccc0006666000008880000ffff0009977079 +022224770000000000444400000ee00000aaaa000088880000088000045454000008a000000ff000099999900cccccc0006666000008880000ffff0009977079 02202944000000000000000000333300000033000000000000033000000330000003300000000000000000000033330000000000000000000000000009997799 202029990000000000000000030330300000033000330300023333300099990003333330000000300000000003ffff3000000000000000000000000009999999 20202099000000000000000030300303000999330000300022233320099a9a90033bb33000000b300000000003ffff3000000000000000000000000009999999 @@ -246,12 +291,20 @@ __gfx__ 0000000000000000000000000ccc8cc0333034300aa55aa00004000006566560055555500ecce4e00757767000cccc0008888480000000000000000000000000 0000000000000000707070700ccc8cc0040004000aa55aa00004000006566560044554400eeee4e0075777700666666008888480000000000000000000000000 00000000bbbbbbbb7b7b7b7bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb000000000000000000000000 +00000000666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666600000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000880880d0009909900d0d0880099000000bb0bb000000000008b9ec00000000000000700007d7d7d000000000000fff00cc0cc0cc0550555000000000 +00000000880880c0009909900c0c0880099000000ba0ba000bbbbb900ce8b9e000000000000707000d7d7d700a0a0a000ffffff0cc0cc0cc0440444000000000 +00000000880880c0090990990c0c0880909909900ba0ba000b999990089beac000000000007070700d7d7d700a9a9a900eeeeef0ff0ff0ff0440444000000000 +00000000880880c0090990990c0c0880909909900bb0bb000bbbbb900ed88ed000000000070707070d7d7d700a9a9a900ffffff0cc0cc0cc0550555000000000 +00000000666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666600000000 +00000000555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555500000000 __map__ 2728000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 3738000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -000000003a3a3a3a3a3a3a3a2a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -000000003a000000002a01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -000000003a000000000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +b9b9b9b5b1b53ab53a3a3a3a2a00000000bdbb000000b5b3b7bdbcbcb200b5b5b50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +b7b5b5b2babbbab5bd2ab1b3b6b6b20000bdbbb9b5b6b4b3b8b7b4b7b8b8b5b5b50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +b1b2b5b2babbbab5b201b3b5b5b5b20000bdbbb9b6b2b4b3b4b4b8b7b5b4b5b5b50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000003a3a3a00000101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000003a3a3a3a00013a010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000003a3a3a3a000101010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000