diff --git a/moonbus.p8 b/moonbus.p8 index 0b42b09..da5aa3e 100644 --- a/moonbus.p8 +++ b/moonbus.p8 @@ -102,7 +102,10 @@ function _update() -- crash detection local pc=plus(plr_pos,{x=0.5,y=-0.5}) - if pc.y <= maph+1 and not plr_static then + local crashed=false + if plr_pos.y<=0 or plr_pos.y>17 then + crashed=true + elseif pc.y <= maph+1 and not plr_static then for p in all({plus(pc,clearx(unit(plr_speed,0.4))), plus(pc,cleary(unit(plr_speed,0.4)))}) do local pmaps=0 if (p.y>=0 and p.y<=maph) then @@ -124,22 +127,25 @@ function _update() end sfx(1) break - elseif solid or plr_pos.y<=0 then - plr_speed.y*=-0.75 - plr_speed.x*=0.5 - plr_alive=false - if (dist(plr_speed) > 1) then - sfx(0) - else - plr_speed.x=0 - plr_speed.y=0 - plr_static=true - sfx(3) - end + elseif solid then + crashed=true break end end end + if crashed then + plr_speed.y*=-0.75 + plr_speed.x*=0.5 + plr_alive=false + if (dist(plr_speed) > 1) then + sfx(0) + else + plr_speed.x=0 + plr_speed.y=0 + plr_static=true + sfx(3) + end + end if plr_alive then telem_spd=mul(plr_speed,1)