guitar working

This commit is contained in:
James Turk 2023-04-09 21:04:20 -05:00
parent 7e06fb57bc
commit 18a44937f8

View File

@ -115,8 +115,10 @@ tbody = {
} -- array of items in body } -- array of items in body
pieces = 1 pieces = 1
last_guitar = 0 last_guitar = 0
do_guitar_reset = false
MAX_PIECES = 200 MAX_PIECES = 200
GUITAR_DELAY = 0.2 -- time before clearing items
GUITAR_DURATION = 0.5 GUITAR_DURATION = 0.5
GUITAR_COOLDOWN = 2 GUITAR_COOLDOWN = 2
@ -215,18 +217,14 @@ function start_level(n)
-- level reset -- level reset
lvl = levels[n] lvl = levels[n]
lvl_start_time = time() lvl_start_time = time()
items = { reset_items()
{x=0, y=0, n=0}, end
{x=0, y=0, n=0},
{x=0, y=0, n=0}, function reset_items()
{x=0, y=0, n=0}, items = {}
{x=0, y=0, n=0}, for i=0,10 do
{x=0, y=0, n=0}, add(items, {x=0, y=0, n=0})
{x=0, y=0, n=0}, end
{x=0, y=0, n=0},
{x=0, y=0, n=0},
{x=0, y=0, n=0},
}
end end
function level_draw() function level_draw()
@ -250,8 +248,14 @@ function level_draw()
end end
toomgis_draw(20, 96-py) toomgis_draw(20, 96-py)
if time() - last_guitar < GUITAR_DURATION then -- percentage of way through guitar duration
local gdp = (time() - last_guitar) / GUITAR_DURATION;
if gdp < 1 then
spr(35, 20, 104-py, 2, 2) spr(35, 20, 104-py, 2, 2)
circ(20, 104-py, 16+(gdp*100), 11)
circ(20, 104-py, 16+(gdp*75), 11)
circ(20, 104-py, 16+(gdp*50), 11)
circ(20, 104-py, 16+(gdp*25), 11)
end end
-- draw item shadows -- draw item shadows
@ -358,11 +362,15 @@ function level_upd()
last_guitar = time() last_guitar = time()
-- now with three amazing jams -- now with three amazing jams
sfx(rnd({14,15,16})) sfx(rnd({14,15,16}))
do_guitar_reset = true
elseif (guitar_elapsed > GUITAR_DELAY) and do_guitar_reset then
reset_items()
do_guitar_reset = false
end end
-- check for falling off back of screen and player collision -- check for falling off back of screen and player collision
for item in all(items) do for item in all(items) do
if item.x < px then if item.x < (px-20) then
item.n = 0 item.n = 0
end end
@ -371,11 +379,11 @@ function level_upd()
if d < toomgis_radius() and item.n != 0 then if d < toomgis_radius() and item.n != 0 then
-- item collision -- item collision
if item.n > 16 then if item.n > 16 then
sfx(5) sfx(5, 0)
hitbody() hitbody()
streak = 0 streak = 0
else else
sfx(6) sfx(6, 0, 0, 4*streak2mult())
for i=1,streak2mult() do for i=1,streak2mult() do
add2body(item.n) add2body(item.n)
end end
@ -633,7 +641,7 @@ __sfx__
361400000050200502275520050200502275520050200502275522455027552005022755227500275522455227550275002755227500275002755227500275002755224550275522750027552245522455222552 361400000050200502275520050200502275520050200502275522455027552005022755227500275522455227550275002755227500275002755227500275002755224550275522750027552245522455222552
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0003000000503165531d5532155324553265532655325553225531e5531a5531855317553195531e5532055323553255532555325553255532555324553235532355322553215531d5531a5531a5531a55319553 0003000000503165531d5532155324553265532655325553225531e5531a5531855317553195531e5532055323553255532555325553255532555324553235532355322553215531d5531a5531a5531a55319553
010200002157124571245712457124571245712457120571095710d5710d5710d5710d5710d5710d5710a57121571245712457124571245712457124571205710a5710d5710d5710d5710d5710d5710d5710a571 000100000c5600e5600e5600c5600e56010560105600e56010560115601156010560115601356013560115601356015560155601356017560185601856017560185601a5601a560185601c5601d5601d5601c560
011400002e4542e4542e4542e45400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 011400002e4542e4542e4542e45400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
01180000220522205227052240522405229052270522705216052160521b05218052180521d0521b0521b052220522205227052240522405229052270522705216052160521b05218052180521d0521b0521b052 01180000220522205227052240522405229052270522705216052160521b05218052180521d0521b0521b052220522205227052240522405229052270522705216052160521b05218052180521d0521b0521b052
011800000670006700067500675000700067500670006750007000070006750067500070006750067000675006700067000675006750007000675006700067500070000700067500675000700067500670006750 011800000670006700067500675000700067500670006750007000070006750067500070006750067000675006700067000675006750007000675006700067500070000700067500675000700067500670006750