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