streak
This commit is contained in:
parent
87ddbff355
commit
c0743ba2c5
38
toomgis.p8
38
toomgis.p8
@ -87,19 +87,16 @@ py = 0
|
||||
vx = 0
|
||||
vy = 0
|
||||
yacc = 0
|
||||
streak = 0
|
||||
|
||||
function toomgis_radius()
|
||||
return 8 + (pieces / MAX_PIECES) * 30
|
||||
return 8 + (pieces / MAX_PIECES) * 40
|
||||
end
|
||||
|
||||
function add2body(n)
|
||||
if pieces < MAX_PIECES then
|
||||
pieces += 1
|
||||
add(tbody, {n=n, r=toomgis_radius() + rnd(7), off=rnd(4)})
|
||||
end
|
||||
-- growth chomp every 10
|
||||
if pieces % 10 == 0 then
|
||||
sfx(6)
|
||||
add(tbody, {n=n, r=toomgis_radius() + rnd(9), off=rnd(4)})
|
||||
end
|
||||
end
|
||||
|
||||
@ -213,8 +210,28 @@ function level_draw()
|
||||
-- hud
|
||||
local size = max(flr(pieces/MAX_PIECES*100), 1)
|
||||
local time_left = 10
|
||||
local streak_str = streak2mult()
|
||||
if streak_str == 1 then
|
||||
streak_str = ""
|
||||
else
|
||||
streak_str = streak_str.."X"
|
||||
end
|
||||
rectfill(0, 0, 128, 8, 2)
|
||||
print("size "..size..lvl.unit.." "..time_left.."S ".."GOAL: 100"..lvl.unit, 1, 1, 9)
|
||||
print("size "..size..lvl.unit.." "..streak_str.." ", 1, 1, 9)
|
||||
print(time_left.."S", 70, 1, 9)
|
||||
print("GOAL 100"..lvl.unit, 88, 1, 9)
|
||||
end
|
||||
|
||||
function streak2mult()
|
||||
if streak > 20 then
|
||||
return 5
|
||||
elseif streak > 10 then
|
||||
return 3
|
||||
elseif streak > 5 then
|
||||
return 2
|
||||
else
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
function draw_stink(x, y)
|
||||
@ -262,8 +279,13 @@ function level_upd()
|
||||
if item.n > 16 then
|
||||
sfx(5)
|
||||
hitbody()
|
||||
streak = 0
|
||||
else
|
||||
add2body(item.n)
|
||||
sfx(6)
|
||||
for i=0,streak2mult() do
|
||||
add2body(item.n)
|
||||
end
|
||||
streak += 1
|
||||
end
|
||||
item.n = 0
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user