-- packages: crates, pile, shouts, grab / deliver function slot_xy(s) local p=pilepos[s] return p[1],p[2]-pdrop -- pdrop tweens the crates into the pile end function spawn_one(s,good) local dv=(not good) and rnd(1)54 then -- fly over the pile + grab a RANDOM pkg local avail={} for p in all(pkgs) do if p.st==0 then add(avail,p) end end local best=rnd(avail) if best then best.st=1 bf.carry=best if best.devil then best.rat=45+devil_grace best.rat_delay=12 end if has_bird and birdt<0 then birdt=0 end -- this level's first pickup wakes the bird; thereafter it auto-respawns until you leave the level frz=2 shake=2 sfx(1) end end end function do_drop() local p=bf.carry if not p then return end p.st=3 p.vx=bf.vx*0.5 p.vy=1 p.x=bf.x p.y=bf.y+6 bf.carry=nil sfx(4) end function draw_pile() if lvl==4 then cloud(46,92)cloud(54,93) -- cloud platform under the crate pile else fillp(0x5a5a) rectfill(41,93,72,96,0x10) fillp() end -- dithered shadow under the pile -- shadow heap behind the 4 bright crates for depth; offset -pdrop tumbles in with them local d=pdrop pal(4,2)pal(15,4) -- body->dark, brace->brown = shadow spr(35,42,86-d)spr(35,64,86-d) -- side bases (floor): poke L/R edges spr(35,42,79-d)spr(35,64,79-d)spr(35,53,72-d) -- L/R upper corners + back peak pal() local sx=39 line(sx,80,sx,95,4) -- post for i=0,5 do line(sx-i,75+i,sx+i,75+i,10) end -- yellow warning triangle line(sx-5,80,sx+5,80,9) -- triangle base print("!",sx-1,77,2) -- bang end function draw_pkg(p) local sx,sy=0,0 local shaking=p.rat>0 and not (p.rat_delay and p.rat_delay>0) if shaking then local mag=p.rat<12 and 3 or 2 sx=rnd(mag*2)-mag sy=flr(rnd(2))-1 if p.rat%6<3 then for i=1,15 do pal(i,7) end end end spr(35,p.x-4+sx,p.y-4+sy) if shaking then pal() end end