balancing

This commit is contained in:
James Turk 2023-04-16 01:03:11 -05:00
parent 8936be9402
commit 2e47d3e7a1

View File

@ -14,7 +14,7 @@ function _draw()
elseif state == "level" then elseif state == "level" then
level_draw() level_draw()
-- DEBUG -- DEBUG
print(px, 0, 120, 7) -- print("px="..px.." vx="..vx, 0, 120, 7)
elseif state == "gameover" then elseif state == "gameover" then
gameover_draw() gameover_draw()
elseif state == "winscreen" then elseif state == "winscreen" then
@ -172,15 +172,11 @@ end
function toomgis_upd() function toomgis_upd()
tangle += vx * 0.01 tangle += vx * 0.01
-- throttle controls half, normal, double speed keep lower bound, not upper px += max(vx, min_speed)
px += max(vx * throttle, min_speed)
py = max(0, py+vy) py = max(0, py+vy)
if px < 2000 then
px = 2000
end -- DEBUG
if px >= 10000 then if px >= 10000 then
px = 0 px = 0
reset_items() reset_items(5)
end end
vy += yacc vy += yacc
@ -205,31 +201,31 @@ levels = {
{ {
mapy=1, mapy=1,
maph=4, maph=4,
bad_item_ratio=0.08, bad_item_ratio=0.07,
unit="CM", unit="CM",
time=120, time=180,
next=2, next=2,
}, },
{ {
mapy=5, mapy=5,
maph=4, maph=4,
bad_item_ratio=0.12, bad_item_ratio=0.10,
unit="M", unit="M",
time=90, time=180,
next=3, next=3,
}, },
{ {
mapy=9, mapy=9,
maph=6, maph=6,
bad_item_ratio=0.18, bad_item_ratio=0.15,
unit="KM", unit="KM",
time=120, time=180,
next=nil, next=nil,
} }
} }
horizon = 64 horizon = 64
min_speed = 1 min_speed = 1
max_speed = 4 max_speed = 5
throttle = 1 throttle = 1
@ -242,14 +238,13 @@ function start_level(n)
py = 0 py = 0
vx = min_speed vx = min_speed
vy = 0 vy = 0
throttle = 0
yacc = 0 yacc = 0
streak = 0 streak = 0
warnings = 0 warnings = 0
-- level reset -- level reset
lvl = levels[n] lvl = levels[n]
lvl_end_time = time() + lvl.time lvl_end_time = time() + lvl.time
reset_items() reset_items(5)
-- initial items on screen -- initial items on screen
for item in all(items) do for item in all(items) do
-- all good -- all good
@ -259,9 +254,9 @@ function start_level(n)
end end
end end
function reset_items() function reset_items(n)
items = {} items = {}
for i=0,5 do for i=0,n do
add(items, {x=0, y=0, n=0}) add(items, {x=0, y=0, n=0})
end end
end end
@ -282,19 +277,23 @@ function fancy_background()
line(cx1+x, cy+y, cx2+x, cy-y, 9) line(cx1+x, cy+y, cx2+x, cy-y, 9)
end end
if px < 3000 then if #tbody < 50 then
print("behold... my true form is unknowable", 0, 50, 9) elseif #tbody < 70 then
elseif px < 4000 then print("OK toomgis", 40, 70, 9)
print("you have OUR attention", 10, 50, 9) elseif #tbody < 80 then
elseif px < 5000 then print("YOU HAVE our ATTENTION", 10, 70, 9)
print("finish your meal", 10, 50, 9) elseif #tbody < 100 then
elseif px < 6000 then print("finish your snack", 30, 70, 9)
print("and then i will show you", 10, 50, 9) if #items < 10 then
elseif px < 7000 then reset_items(20)
print("entire worlds", 40, 50, 9) lvl.bad_item_ratio = 0
elseif px < 8000 then GOAL = 200
print("in need of...", 40, 50, 9) end
elseif px < 9000 then elseif #tbody < 120 then
print("AND THEN we WILL SHOW YOU", 10, 70, 9)
elseif #tbody < 150 then
print("entire worlds in need of...", 40, 70, 9)
elseif #tbody < 200 then
print("a fresh start", 0, 50, 9) print("a fresh start", 0, 50, 9)
end end
@ -315,7 +314,7 @@ function level_bg(unit)
end end
else else
cls(0) cls(0)
if px < 2000 then if px < 2500 then
cls(1) cls(1)
else else
fancy_background() fancy_background()
@ -443,18 +442,13 @@ function level_upd()
vy = 0 vy = 0
end end
if btn(⬅️) then if btn(➡️) then
throttle = 0.5 vx = min(vx + 0.01, max_speed)
elseif btn(➡️) then
throttle = 2
else
throttle = 1
end end
if btnp(⬆️) then if btnp(⬆️) then
-- DEBUG
start_level(lvl.next) start_level(lvl.next)
end end -- DEBUG
-- guitar -- guitar
local guitar_elapsed = time() - last_guitar local guitar_elapsed = time() - last_guitar
@ -464,7 +458,7 @@ function level_upd()
sfx(rnd({14,15,16})) sfx(rnd({14,15,16}))
do_guitar_reset = true do_guitar_reset = true
elseif (guitar_elapsed > GUITAR_DELAY) and do_guitar_reset then elseif (guitar_elapsed > GUITAR_DELAY) and do_guitar_reset then
reset_items() reset_items(5)
do_guitar_reset = false do_guitar_reset = false
end end
@ -482,9 +476,6 @@ function level_upd()
hitbody() hitbody()
streak = 0 streak = 0
vx = max(vx - 1, min_speed) vx = max(vx - 1, min_speed)
if vx < min_speed then
vx = min_speed
end
else else
local mult = streak2mult() local mult = streak2mult()
sfx(6, 0, 0, 4*mult) sfx(6, 0, 0, 4*mult)
@ -651,12 +642,12 @@ function explainer_draw()
draw_stink(ix, iy) draw_stink(ix, iy)
end end
toomgis_draw(50, 50) toomgis_draw(50, 42)
spr(33, 50, 60, 2, 2) spr(33, 50, 50, 2, 2)
print("stinky makes toomgis upset", 7, 120, 9) print("stinky makes toomgis upset", 7, 120, 9)
print("❎ jump\ngrab/dodge\n", 5, 50) print("❎ jump\n➡️ accel\n🅾 shred", 5, 52)
print("🅾️ shred\nclear screen\n", 70, 50) print(" grow 100X\n to clear\n 200X to skip", 70, 52)
end end
function explainer_upd() function explainer_upd()