@@ 23,7 23,7 @@ function draw_path(cx,points){"( cx (poi
function make_spritesheet(path){return (((i) => {((i)["src"]=path);return i;})((new Image())));};
var Sprites={cat:(make_spritesheet("i/sprites-cat.png")),mob:(make_spritesheet("i/sprites-mobs.png"))};
function make_sound(path){return (((s) => {((s)["src"]=path);return s;})((new Audio())));};
-var Sounds={ponk:(make_sound("a/Interface Element 3.mp3")),aarg:(make_sound("a/Almost.mp3")),win:(make_sound("a/Game Over Good.mp3")),lose:(make_sound("a/Game Over Bad.mp3")),king:(make_sound("a/hall-of-the-mountain-king-by-kevin-macleod-from-filmmusic-io.mp3"))};
+var Sounds={ponk:(make_sound("a/Interface Element 3.mp3")),pop:(make_sound("a/Pop.mp3")),aarg:(make_sound("a/Almost.mp3")),win:(make_sound("a/Game Over Good.mp3")),lose:(make_sound("a/Game Over Bad.mp3")),king:(make_sound("a/hall-of-the-mountain-king-by-kevin-macleod-from-filmmusic-io.mp3"))};
function play(what){return (((s) => {((s)["currentTime"]=0);return ((s.play)());})(Sounds[what]));};
function all_stop(){return ((() => {var a=((Object.values)(Sounds)),n=a.length,i=0;while((true&&true&&(i<n))){(((s) => {((s.pause)());((s)["currentTime"]=0);return (i+=1);})(a[i]));};undefined;return undefined;})());};
function arrange(rack,run,origin){"( rack run origin -- (p0 p1 p2 ...)) Compute tile coordinates for rack locations.";return (((x) => {return (((y) => {return ((() => {return (((a) => {{var i=0,t=rack.length;while((true&&true&&(i<t))){(((i_1) => {(((zero_p((i_1%run)))===false)?(x=(x+32)):((x=(first(origin))),(y=(y+48))));((a.push)([x,y]));return (i+=1);})(i));};undefined;}return a;})([]));})());})((second(origin))));})((first(origin))));};
@@ 38,13 38,13 @@ function draw_tile(cx,offset,top,left,ri
function draw_tile_mini(cx,offset,top,left,right){"( cx offset top left right --) Draw mini-block for HUD.";{var a=[[left,[[0,4],[8,8],[8,16],[0,12]]],[right,[[8,16],[8,8],[16,4],[16,12]]],[top,[[0,4],[8,0],[16,4],[8,8]]]],n=a.length,i=0;while((true&&true&&(i<n))){(((x) => {(cx["fillStyle"]=(first(x)));(draw_path(cx,(adjust((second(x)),offset))));((cx.fill)());return (i+=1);})(a[i]));};undefined;}(cx["strokeStyle"]="black");(draw_path(cx,(adjust([[0,4],[8,0],[16,4],[16,12],[8,16],[0,12]],offset))));return ((cx.stroke)());};
function draw_hud(cx,game,player_3,colour){"( cx game player /colour/ --) Draw information overlay.";(colour=(colour||"black"));(cx["font"]="20px HUD");(cx["fillStyle"]=colour);((cx["fillText"])(("Score: "+player_3.score),32,40));((cx["fillText"])(("Falls: "+player_3.falls),32,60));((cx["fillText"])(game.level.name,32,128));{var i=0,t=game.level.turn.length;while((true&&true&&(i<t))){(((i_4) => {(draw_tile_mini(cx,[(32+(32*i_4)),(128+20)],game.level.turn[i_4],(first(game.level.base)),(second(game.level.base))));return (i+=1);})(i));};undefined;}return (((x,y) => {(cx["font"]="10px HUD");(cx["fillStyle"]=colour);((cx["fillText"])(("fps: "+game.log.fps),x,y));return ((cx["fillText"])(("v: "+VERSION),x,(y+10)));})((APP.screen.width-64),(APP.screen.height-26)));};
function whereis(rack,mob){"( rack mob -- (x y)) Convert mob location on rack to screen coords.";return ((((undefined===mob.target)||(-1===mob.target))===false)?(((p) => {return (((t) => {return (((dx) => {return (((dy) => {return ((() => {return [((first(p))+(mob.x*dx)),((second(p))+(mob.x*dy))];})());})(((second(t))-(second(p)))));})(((first(t))-(first(p)))));})(rack[mob.target]));})(rack[mob.i])):rack[mob.i]);};
-function draw(screen,cx){"( screen cx --) Draw current scene.";((cx["clearRect"])(0,0,screen.width,screen.height));(cx["strokeStyle"]="red");((cx["strokeRect"])(0,0,screen.width,screen.height));(((base,turn) => {return ((() => {var i=0,t=Game.level.layout.length;while((true&&true&&(i<t))){(((i_5) => {(((1===Game.level.layout[i_5])===false)?undefined:((() => {return (draw_tile(cx,Game.level.tiles[i_5],turn[Game.level.tops[i_5]],(first(base)),(second(base))));})()));return (i+=1);})(i));};undefined;return undefined;})());})(Game.level.base,Game.level.turn));(((p) => {return (((f) => {return ((() => {((("FALL"===player.state)===false)?undefined:((() => {return (p=[(first(p)),((second(p))+(first(player.x)))]);})()));((("DROP"===player.state)===false)?undefined:((() => {return (p=[(first(p)),((second(p))-(first(player.x)))]);})()));return ((cx["drawImage"])(Sprites.cat,(128*(first(f))),(128*player.face),128,128,(first(p)),(second(p)),128,128));})());})((frame_get(player))));})((whereis(Game.level.tmobs,player))));(((!("HIDE"===yarnball.state))===false)?undefined:((() => {return (((p) => {return ((() => {((("DROP"===yarnball.state)===false)?undefined:((() => {return (p=[(first(p)),((second(p))-(first(yarnball.x)))]);})()));return ((cx["drawImage"])(Sprites.mob,0,0,128,128,(first(p)),(second(p)),128,128));})());})((whereis(Game.level.tmobs,yarnball))));})()));return (draw_hud(cx,Game,player));};
+function draw(screen,cx){"( screen cx --) Draw current scene.";((cx["clearRect"])(0,0,screen.width,screen.height));(cx["strokeStyle"]="red");((cx["strokeRect"])(0,0,screen.width,screen.height));(((base,turn) => {return ((() => {var i=0,t=Game.level.layout.length;while((true&&true&&(i<t))){(((i_5) => {(((1===Game.level.layout[i_5])===false)?undefined:((() => {return (draw_tile(cx,Game.level.tiles[i_5],turn[Game.level.tops[i_5]],(first(base)),(second(base))));})()));return (i+=1);})(i));};undefined;return undefined;})());})(Game.level.base,Game.level.turn));(((p) => {return (((f) => {return ((() => {((("FALL"===player.state)===false)?undefined:((() => {return (p=[(first(p)),((second(p))+(first(player.x)))]);})()));((("DROP"===player.state)===false)?undefined:((() => {return (p=[(first(p)),((second(p))-(first(player.x)))]);})()));return ((cx["drawImage"])(Sprites.cat,(128*(first(f))),(128*player.face),128,128,(first(p)),(second(p)),128,128));})());})((frame_get(player))));})((whereis(Game.level.tmobs,player))));(((!("HIDE"===yarnball.state))===false)?undefined:((() => {return (((p) => {return ((() => {((("DROP"===yarnball.state)===false)?((("JUMP"===yarnball.state)===false)?undefined:((() => {return (p=[(first(p)),((second(p))-(64*((Math.sin)((yarnball.x*3.14159)))))]);})())):((() => {return (p=[(first(p)),((second(p))-(first(yarnball.x)))]);})()));return ((cx["drawImage"])(Sprites.mob,0,0,128,128,(first(p)),(second(p)),128,128));})());})((whereis(Game.level.tmobs,yarnball))));})()));return (draw_hud(cx,Game,player));};
function level_winning(level){"( level --) Level has been completed.";((level)["state"]="win");(all_stop());return (play("win"));};
function level_done_p(level){"( level -- f) Is level completed (all cubes turned correct colour)?";return (0===((level.tops.filter)(((x) => {return (!((x<0)||(level.done===x)));})))["length"]);};
function mob_dropping(m,target){"( m target -- m) Set up to drop from height.";((m)["i"]=target);((m)["target"]=-1);((m)["x"]=[150,10]);return (state_set(m,"DROP"));};
function player_landing(p,target){"( p target --) Land player p on target.";((p)["i"]=target);((p)["target"]=-1);(state_set(p,"IDLE"));(((tops) => {return (tops[p.i]=1);})(Game.level.tops));(play("ponk"));return (((level_done_p(Game.level))===false)?undefined:((() => {return (level_winning(Game.level));})()));};
function player_falling(p,start){"( p start --) Set up player to start falling.";((p)["falls"]=(p.falls+1));((p)["i"]=start);((p)["target"]=-1);((p)["x"]=[0,1]);(state_set(p,"FALL"));return (play("aarg"));};
-function yarnball_landing(m,target){((m)["i"]=target);((m)["target"]=(target+Game.level.run+(choose([-1,1]))));((m)["x"]=0);return (state_set(m,"JUMP"));};
+function yarnball_landing(m,target){((m)["i"]=target);((m)["target"]=(target+Game.level.run+(choose([-1,1]))));((m)["x"]=0);(state_set(m,"JUMP"));return (play("pop"));};
function frame_get(m,n){"( m /n/ -- (s d)|f|state) Get next frame from current animation.";return m.anim[m.state][(n||m.frame)];};
function frame_set(m,f){"( m f -- m) Set m.frame to f. Reset ticks.";((m)["frame"]=f);((m)["tick"]=0);return m;};
function state_set(m,s){"( m s -- m) Set new state for mob.";((m)["state"]=s);return (frame_set(m,0));};