Something went wrong. Try again.
an npmx inspired game for PICO-8 npicomx.vinnymac.dev
games pico-8 adventure npmx
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758-- level: level / state lifecycle
function load_level(n) lvl=n lvox=(n%2)*48 lvoy=(n\2)*16 local r=levels[n+1] local q=lsc[n+1] -- {bird,bx,by,ey,w} lvw=q[5] pkgs={} names={} embers={} shouts={} ems={} for i=1,#r.em do local e=r.em[i] add(ems,{x=e[1],y=e[2],dir=e[3],peak=14+i%3*5,ph=i*0.13,h=0}) end sprc=r.sp dec=r.dec balx,baly=q[2],q[3] bird={on=false}birdt=-1 has_bird=q[1]==1 and (lvl>=2 or diff>=2) -- birdt: respawn timer (-1=off until this level's first pickup arms it, 0=spawn now, >0=counting) pdrop=30 phase=0 trans=11 camx=0 nograb=0 -- trans=11: ember wipe runs ~100ms longer than the old 8 bf.x,bf.y,bf.vx,bf.vy,bf.rx,bf.ry,bf.carry=-8,q[4],0,0,0,0,nil entering=true enter_ready=(dlg==nil) bf.trail={} wisps={} wst=0 if n==4 then mk_birds() end -- flocking birds in the cloud level (same boids as credits) fill_cage()end
function next_level() if cloud_run then cloud_win() return end if lvl+1>=4 then start_win() return end load_level(lvl+1)end
function enter_cloud() devil_pct=0 -- no demons in the secret level load_level(4) cloud_run=true dlg=nilend
function cloud_win() dset(4,1) cloud_run=false menuitem(1,skin_label(),tog_skin) dtext_c={"secret level|cleared!","pause to change|butterfly skin!"} cloud_exit=true dlg=1 dly=128 dtimer=0 phase=0end
function init_play() local d=diffs[diff] devil_pct,maxhp=d[2],d[3] flrate=0.5-d[1]/400 clock=d[4]*30 devil_grace=d[5] bf={x=16,y=96,vx=0,vy=0,rx=0,ry=0,hp=maxhp,carry=nil,iv=0,flip=false,fl=6} saved=0 purged=0 shake=0 frz=0 t_out=false dflash=0 playt=0 dying=false kill_cause="" cloud_run=false cloud_exit=false dtext_c=nil aemb={} -- screen-space rising-ember pool (ambient, persists across levels) for _=1,20 do add(aemb,{x=rnd(128),y=rnd(128),sp=0.3+rnd(0.6),ph=rnd(1)}) end dlg=1 dly=130 dtimer=0 -- intro dialog (level 1) load_level(0) music(0) scr=2end