moonbus: audio visual fuel warning improvement

This commit is contained in:
Dejvino 2024-08-11 10:16:42 +02:00
parent 50ba71fb65
commit 09ddcac1ad

View File

@ -53,6 +53,8 @@ function load_level()
engine_power=0.1
fuel_cons=0.01
fuel_warning=0.3
fuel_warning_on=false
land_speed_limit=1
bonus_docked=1
transed_per_level=5
@ -125,11 +127,23 @@ function _update()
if plr_engine != -1 then
sfx(2,2)
plr_fuel=max(0,plr_fuel-fuel_cons)
plr_fuel=max(0,min(1,plr_fuel-fuel_cons))
else
sfx(-1,2)
end
if plr_alive and plr_fuel < fuel_warning then
if plr_fuel <= 0.01 then
sfx(5,3)
elseif not fuel_warning_on then
fuel_warning_on=true
sfx(5,3)
end
else
fuel_warning_on=false
sfx(-1,3)
end
if plr_docked then
plr_fuel=min(1,plr_fuel+fuel_cons)
end
@ -273,8 +287,10 @@ function _draw()
local fx=85
local fy=0
rect(fx,fy,fx+fw,fy+fh,5)
rectfill(fx+1,fy+1,fx+plr_fuel*(fw-1),fy+fh-1,plr_fuel > 0.25 and 13 or 8)
print("fuel", fx+3,fy+1,1)
if plr_fuel > 0 then
rectfill(fx+1,fy+1,fx+1+plr_fuel*(fw-2),fy+fh-1,plr_fuel > fuel_warning and 13 or 8)
end
print("fuel", fx+3,fy+1,plr_fuel <= fuel_warning and 9 or 1)
-- telemetry
local cr=10
@ -725,7 +741,7 @@ __sfx__
0001002005750087500b7500b7500a750067500375005750087500a7500b7500a75009750047500475006750097500a7500a75009750087500675006750087500a7500a75008750067500675008750097500a750
00020000226502265026150241501d150161500e1500c150061500315001150001500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
010800002605000000260502163021610216102161600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000a00082405024050240500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000