moonbus: hot and cold particles

This commit is contained in:
Dejvino 2024-08-12 08:03:09 +02:00
parent 1f54a2f8f3
commit ee5c2bb312

View File

@ -130,7 +130,7 @@ function _update()
if plr_engine != -1 then
sfx(2,2)
plr_fuel=max(0,min(1,plr_fuel-fuel_cons))
generate_particle(plr_pos)
generate_particle(true)
else
sfx(-1,2)
end
@ -207,10 +207,10 @@ function _update()
plr_speed.x*=0.5
plr_alive=false
if (dist(plr_speed) > 1) then
for i=1,10 do generate_particle() end
for i=1,10 do generate_particle(false) end
sfx(0)
else
for i=1,20 do generate_particle() end
for i=1,20 do generate_particle(false) end
plr_speed.x=0
plr_speed.y=0
plr_static=true
@ -275,7 +275,7 @@ function _draw()
local p=part.p
local px,py=to_scrn(p)
--pset(px,py,ttl > 10 and 8 or 5)
circ(px,py,cos(part.age/20)*0.6+1.5,part.age < 10 and 8 or (part.age < part.limit/2 and 5 or 1))
circ(px,py,cos(part.age/20)*0.6+1.5,part.age < 20 and 8 or (part.age < part.limit/2 and 5 or 1))
end
print(#particles, 32,50,11)
@ -405,12 +405,13 @@ function next_target()
plr_target={x=mp.x,y=maph-mp.y+1}
end
function generate_particle()
function generate_particle(hot)
hot=hot or false
add(particles,{
p=plus(plus(plr_pos,{x=0.25,y=-0.85}),{x=rnd(),y=rnd()},0.5),
spd=plus(mul({x=rnd(2)-1,y=rnd(2)-1},0.1),mul(plr_speed,rnd(0.5))),
age=rnd(20),
limit=80+flr(rnd(40))
age=rnd(20) + (hot and 0 or 20),
limit=80+flr(rnd(40)) + (hot and 0 or 20)
})
end