getting weird in l3

This commit is contained in:
James Turk 2023-04-14 05:12:39 -05:00
parent 93952ad87e
commit 8936be9402

View File

@ -13,6 +13,8 @@ function _draw()
ampm_draw()
elseif state == "level" then
level_draw()
-- DEBUG
print(px, 0, 120, 7)
elseif state == "gameover" then
gameover_draw()
elseif state == "winscreen" then
@ -170,8 +172,12 @@ end
function toomgis_upd()
tangle += vx * 0.01
px += vx
-- throttle controls half, normal, double speed keep lower bound, not upper
px += max(vx * throttle, min_speed)
py = max(0, py+vy)
if px < 2000 then
px = 2000
end -- DEBUG
if px >= 10000 then
px = 0
reset_items()
@ -198,6 +204,7 @@ end
levels = {
{
mapy=1,
maph=4,
bad_item_ratio=0.08,
unit="CM",
time=120,
@ -205,6 +212,7 @@ levels = {
},
{
mapy=5,
maph=4,
bad_item_ratio=0.12,
unit="M",
time=90,
@ -212,15 +220,17 @@ levels = {
},
{
mapy=9,
maph=6,
bad_item_ratio=0.18,
unit="KM",
time=90,
time=120,
next=nil,
}
}
horizon = 64
min_speed = 1
max_speed = 4
throttle = 1
function start_level(n)
@ -232,6 +242,7 @@ function start_level(n)
py = 0
vx = min_speed
vy = 0
throttle = 0
yacc = 0
streak = 0
warnings = 0
@ -260,33 +271,64 @@ function fancy_background()
local cx2 = 108
local cy = 40
for a=0,120,10 do
line(0, a, 128, a, 11)
line(a, 0, a, 128, 11)
end
-- for a=0,120,10 do
-- line(0, a, 128, a, 11)
-- line(a, 0, a, 128, 11)
-- end
for i=0,8 do
local x = 20*cos((i+t())/8)
local y = 30*sin((i+t())/8)
line(cx1+x, cy+y, cx2+x, cy-y, 9)
end
if px < 3000 then
print("behold... my true form is unknowable", 0, 50, 9)
elseif px < 4000 then
print("you have OUR attention", 10, 50, 9)
elseif px < 5000 then
print("finish your meal", 10, 50, 9)
elseif px < 6000 then
print("and then i will show you", 10, 50, 9)
elseif px < 7000 then
print("entire worlds", 40, 50, 9)
elseif px < 8000 then
print("in need of...", 40, 50, 9)
elseif px < 9000 then
print("a fresh start", 0, 50, 9)
end
end
function level_bg(unit)
if unit == "CM" then
cls(7)
elseif unit == "M" then
if px < 2000 then
cls(12)
elseif px < 4000 then
cls(140)
elseif px < 6000 then
cls(2)
else
cls(1)
end
else
cls(0)
if px < 2000 then
cls(1)
else
fancy_background()
end
end
end
function level_draw()
level_bg(lvl.unit)
-- each level is 4tl/32px
if px < 2000 then
cls(12)
elseif px < 4000 then
cls(140)
elseif px < 6000 then
cls(2)
else
cls(1)
end
--fancy_background()
--- zoom should go from 16 to 1 w/ growth
local zoom = 16 - (15 * -sin(#tbody / MAX_PIECES / 4))
local h=32 * zoom
local h=lvl.maph * 8 * zoom
for y=0,h do
tline(0, 128-h+y, 128, 128-h+y, -- screen coordinates (entire screen scanlines)
px/100, lvl.mapy+y/(8*zoom), 1/(8*zoom), 0)
@ -401,6 +443,14 @@ function level_upd()
vy = 0
end
if btn(⬅️) then
throttle = 0.5
elseif btn(➡️) then
throttle = 2
else
throttle = 1
end
if btnp(⬆️) then
-- DEBUG
start_level(lvl.next)