QOL fixes
This commit is contained in:
parent
08cbd07856
commit
af2ee0a1ce
61
toomgis.p8
61
toomgis.p8
@ -136,14 +136,27 @@ function add2body(n)
|
||||
end
|
||||
|
||||
function hitbody()
|
||||
local ejected = 0
|
||||
for piece in all(tbody) do
|
||||
if rnd() < 0.2 then
|
||||
piece.ejecting = true
|
||||
ejected += 1
|
||||
end
|
||||
end
|
||||
printh("ejected "..ejected)
|
||||
end
|
||||
|
||||
function toomgis_draw(x, y)
|
||||
shadow_pal()
|
||||
for i=1,#tbody do
|
||||
-- rotate drawing order
|
||||
local bs = tbody[(i+flr(tangle)) % #tbody + 1]
|
||||
spr(bs.n,
|
||||
x+5+bs.r*sin(tangle+bs.off),
|
||||
y+5+bs.r*cos(tangle+bs.off)
|
||||
)
|
||||
end
|
||||
pal()
|
||||
for i=1,#tbody do
|
||||
-- rotate drawing order
|
||||
local bs = tbody[(i+flr(tangle)) % #tbody + 1]
|
||||
@ -189,7 +202,7 @@ levels = {
|
||||
mapy=2,
|
||||
bad_item_ratio=0.12,
|
||||
unit="CM",
|
||||
time=300,
|
||||
time=120,
|
||||
next=2,
|
||||
},
|
||||
{
|
||||
@ -199,7 +212,7 @@ levels = {
|
||||
mapy=5,
|
||||
bad_item_ratio=0.16,
|
||||
unit="M",
|
||||
time=240,
|
||||
time=90,
|
||||
next=nil,
|
||||
},
|
||||
}
|
||||
@ -217,9 +230,10 @@ function start_level(n)
|
||||
vy = 0
|
||||
yacc = 0
|
||||
streak = 0
|
||||
warnings = 0
|
||||
-- level reset
|
||||
lvl = levels[n]
|
||||
lvl_start_time = time()
|
||||
lvl_end_time = time() + lvl.time
|
||||
reset_items()
|
||||
end
|
||||
|
||||
@ -235,15 +249,14 @@ function level_draw()
|
||||
--rectfill(0, 0, 128, horizon, lvl.sky)
|
||||
--rectfill(0, horizon, 128, 128, lvl.gnd)
|
||||
|
||||
--map(0, lvl.y, 0, 32, 16, 8)
|
||||
-- each level is 3tl/24px
|
||||
-- each level is 4tl/32px
|
||||
cls(lvl.sky)
|
||||
--- zoom should go from 16 to 2 w/ growth
|
||||
local zoom = 16 - (14 * (#tbody / MAX_PIECES))
|
||||
local h=24 * zoom
|
||||
--- zoom should go from 16 to 1 w/ growth
|
||||
local zoom = 16 - (15 * -sin(#tbody / MAX_PIECES / 4))
|
||||
local h=32 * zoom
|
||||
for y=0,h do
|
||||
tline(0, 128-h+y, 128, 128-h+y, -- screen coordinates (entire screen scanlines)
|
||||
px/80, 2+y/(8*zoom), 1/(8*zoom), 0)
|
||||
px/80, 1+y/(8*zoom), 1/(8*zoom), 0)
|
||||
-- don't scale x start with zoom, since position is not dependent
|
||||
end
|
||||
|
||||
@ -255,10 +268,13 @@ function level_draw()
|
||||
circ(20, 104-py, 16+(gdp*75), 11)
|
||||
circ(20, 104-py, 16+(gdp*50), 11)
|
||||
circ(20, 104-py, 16+(gdp*25), 11)
|
||||
else
|
||||
spr(35, 20, 104-py, 2, 2)
|
||||
end
|
||||
|
||||
-- draw guitar
|
||||
spr(35, 20, 104-py, 2, 2)
|
||||
-- draw flames if within cooldown
|
||||
|
||||
|
||||
-- draw item shadows
|
||||
shadow_pal()
|
||||
for item in all(items) do
|
||||
@ -295,7 +311,7 @@ function level_draw()
|
||||
end
|
||||
|
||||
function time_left()
|
||||
return flr(max(0, (lvl.time+lvl_start_time)-time()))
|
||||
return flr(max(0, lvl_end_time-time()))
|
||||
end
|
||||
|
||||
function streak2mult()
|
||||
@ -318,16 +334,31 @@ function draw_stink(x, y)
|
||||
end
|
||||
|
||||
function level_upd()
|
||||
if time_left() <= 0 then
|
||||
-- check timer and state
|
||||
if time_left() < 10 and warnings == 0 then
|
||||
sfx(7)
|
||||
warnings += 1
|
||||
elseif time_left() < 5 and warnings == 1 then
|
||||
sfx(7)
|
||||
warnings += 1
|
||||
elseif time_left() <= 0 then
|
||||
if #tbody < GOAL then
|
||||
start_gameover()
|
||||
elseif lvl.next != nil then
|
||||
sfx(11)
|
||||
start_level(lvl.next)
|
||||
else
|
||||
start_winscreen()
|
||||
end
|
||||
end
|
||||
|
||||
if #tbody == MAX_PIECES and warnings < 2 then
|
||||
-- advance time
|
||||
sfx(11)
|
||||
lvl_end_time = time() + 3
|
||||
warnings = 2
|
||||
end
|
||||
|
||||
|
||||
if btn(➡️) then
|
||||
vx += 0.1
|
||||
@ -352,6 +383,10 @@ function level_upd()
|
||||
vy = 0
|
||||
end
|
||||
|
||||
if btnp(⬆️) then
|
||||
add2body(rnd(12)+2)
|
||||
end
|
||||
|
||||
-- guitar
|
||||
local guitar_elapsed = time() - last_guitar
|
||||
if btnp(🅾️) and guitar_elapsed > GUITAR_COOLDOWN then
|
||||
|
Loading…
Reference in New Issue
Block a user