Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update to version 0.1.21

  • Loading branch information...
commit 4959d77bfa68e3495f20802cfd3795a976978267 1 parent e460938
@izb authored
View
43 dist/snaps.js
@@ -2831,11 +2831,31 @@ define('input/ui/button',[],function() {
});
/*global define*/
+define('input/ui/label',[],function() {
+
+ /**
+ * @module input/ui/label
+ */
+
+
+
+ /** A label is a piece of text to display on a UI layout.
+ * @constructor module:input/ui/label.Label
+ */
+ function Label(sn) {
+ this.sn = sn;
+ }
+
+ return Label;
+});
+
+/*global define*/
define('input/ui/panel',['util/uid',
'input/ui/button',
+ 'input/ui/label',
'sprites/sprite'],
-function(uid, Button, Sprite) {
+function(uid, Button, Label, Sprite) {
/**
* @module input/ui/panel
@@ -3008,6 +3028,8 @@ function(uid, Button, Sprite) {
/* Sprites expect map offsets, which are the opposite of our screen offsets, so we
* negate them here. */
c.draw(ctx, -xo, -yo, now);
+ } else if (c instanceof Label) {
+ /* TODO */
} else {
/* TODO */
throw "Can't draw "+c;
@@ -3022,25 +3044,6 @@ function(uid, Button, Sprite) {
});
/*global define*/
-define('input/ui/label',[],function() {
-
- /**
- * @module input/ui/label
- */
-
-
-
- /** A label is a piece of text to display on a UI layout.
- * @constructor module:input/ui/label.Label
- */
- function Label(sn) {
- this.sn = sn;
- }
-
- return Label;
-});
-
-/*global define*/
define('input/all',[
'input/keyboard',
'input/mouse',
View
90 dist/snaps.min.js
@@ -9,47 +9,47 @@ a){var c=this.sn.getNow();this.setState(b,a,c-this.state.dur*this.state.jogPos(t
if(c.predicate.call(this)){var f=void 0===c.phaser?!0:c.phaser.phase(this,b);if(!c.update(b,f))break}}};d.prototype.drawAt=function(b,a,c,f){(this.active||!this.autoRemove)&&this.state.draw(b,a,c,this.epoch,f,!this.active&&!this.autoRemove)};d.prototype.moveTo=function(b,a,c,f){void 0!==c&&(c-=this.h);return this.move(b-this.x,a-this.y,c,f)};d.prototype.move=function(b,a,c,f){if(!b&&!a&&!c)return!1;f=void 0===f?!0:f;var d;f&&void 0!==this.collider?(d=this.collider.test(this.x,this.y,b,a,this.h,this.collisionPoint),
this.x=this.collisionPoint[0],this.y=this.collisionPoint[1]):(this.x+=b,this.y+=a);this.setDirection(this.x+b,this.y+a);b=f&&1>d;void 0!==c&&(this.h=b&&!this.quantizedHeight?this.h+c*d:this.h+c);return b};d.prototype.setDirection=function(b,a){this.directionx=b;this.directiony=a;this.directionNormalized=!1};d.prototype.vector=function(b){if(!this.directionNormalized){this.directionNormalized=!0;var a=this.directionx-this.x,c=this.directiony-this.y;if(0===a&&0===c)this.vectory=this.vectorx=0;else{var f=
Math.sqrt(a*a+c*c);this.vectorx=a/f;this.vectory=c/f}}b[0]=this.vectorx;b[1]=this.vectory};d.prototype.vectorTo=function(b,a,c){b-=this.x;a-=this.y;if(0===b&&0===a)c[0]=0,c[1]=0;else{var f=Math.sqrt(b*b+a*a);c[0]=b/f;c[1]=a/f}};d.prototype.draw=function(b,a,c,f){this.drawAt(b,this.x-(a|0)-this.def.x,this.y-(c|0)-this.def.y-this.h,f)};d.prototype.onRemove=function(){if(void 0!==this.updates)for(var b=0;b<this.updates.length;b++){var a=this.updates[b];void 0!==a.phaser&&a.phaser.removeSprite(this);
-a.onSpriteRemoved()}};var f=function(){return!0};d.construct=function(a,h,g,l,n,m,q,p){if(!a.spriteDefs.hasOwnProperty(h))throw"Error: Missing sprite definition when spawning sprite "+h;var t=a.spriteDefs[h],r=function(b){var a=typeof b.predicate;if("string"===a){var c=b.predicate;return function(){return u.stateName===c}}if("object"===a){for(var e={},a=b.predicate.length-1;0<=a;a--)e[b.predicate[a]]=!0;return function(){return e.hasOwnProperty(u.stateName)}}return"function"===a?b.predicate:f},s=
-p.updates;if(void 0!==s){s=Array(p.updates.length);for(h=0;h<p.updates.length;h++){var y=p.updates[h],B=y.name;if(!a.spriteUpdaters.hasOwnProperty(B))throw"Sprite plugin not registered: "+B;s[h]=new a.spriteUpdaters[B];c(y,s[h]);s[h].predicate=r(y)}}y=p.commits;if(void 0!==y){y=Array(p.commits.length);for(h=0;h<p.commits.length;h++){var B=p.commits[h],w=B.name;if(!a.spriteUpdaters.hasOwnProperty(w))throw"Sprite plugin not registered: "+w;y[h]=new a.spriteUpdaters[w];c(B,y[h]);y[h].predicate=r(B)}}p=
-b(p);p.updates=s;p.commits=y;var u=new d(a,t,n,m,q,p);u.setState(g,l);if(void 0!==p.opts)for(var v in p.opts)u[v]=p.opts[v];u.init();return u};return d});
-define("sprites/composite",["util/js","sprites/sprite"],function(a,d){function c(b,a,c,f,d){this.sn=b;this.x=a;this.y=c;this.endCallback=d;this.active=!0;this.sprites=[]}var b=a.copyProps,f=a.clone;c.prototype.init=function(){};c.prototype.addSprite=function(a,c,g,l,n,m){void 0===m&&(m={});a=this.sn.spriteDefs[a];var q=m.updates;if(void 0!==q)for(var q=Array(m.updates.length),p=0;p<m.updates.length;p++)q[p]=new this.sn.spriteUpdaters[m.updates[p].name],b(m.updates[p],q[p]);m=f(m);m.updates=q;g=new d(this.sn,
-a,g,l,n,m);g.setState(c);if(void 0!==m.opts)for(var t in m.opts)g[t]=m.opts[t];g.init();this.sprites.push(g);return g};c.prototype.isActive=function(b){if(!this.active)return!1;for(var a=!1,c=this.sprites.length-1;0<=c;c--)this.sprites[c].isActive(b)?a=!0:this.sprites.splice(c,1);this.active=a;!this.active&&void 0!==this.endCallback&&this.endCallback();return a};c.prototype.update=function(b,a){for(var c=this.sprites.length-1;0<=c;c--)void 0!==a&&a(this.sprites[c],b),this.sprites[c].update()};c.prototype.draw=
+a.onSpriteRemoved()}};var f=function(){return!0};d.construct=function(a,h,g,l,p,m,q,n){if(!a.spriteDefs.hasOwnProperty(h))throw"Error: Missing sprite definition when spawning sprite "+h;var t=a.spriteDefs[h],r=function(b){var a=typeof b.predicate;if("string"===a){var c=b.predicate;return function(){return u.stateName===c}}if("object"===a){for(var e={},a=b.predicate.length-1;0<=a;a--)e[b.predicate[a]]=!0;return function(){return e.hasOwnProperty(u.stateName)}}return"function"===a?b.predicate:f},s=
+n.updates;if(void 0!==s){s=Array(n.updates.length);for(h=0;h<n.updates.length;h++){var y=n.updates[h],B=y.name;if(!a.spriteUpdaters.hasOwnProperty(B))throw"Sprite plugin not registered: "+B;s[h]=new a.spriteUpdaters[B];c(y,s[h]);s[h].predicate=r(y)}}y=n.commits;if(void 0!==y){y=Array(n.commits.length);for(h=0;h<n.commits.length;h++){var B=n.commits[h],w=B.name;if(!a.spriteUpdaters.hasOwnProperty(w))throw"Sprite plugin not registered: "+w;y[h]=new a.spriteUpdaters[w];c(B,y[h]);y[h].predicate=r(B)}}n=
+b(n);n.updates=s;n.commits=y;var u=new d(a,t,p,m,q,n);u.setState(g,l);if(void 0!==n.opts)for(var v in n.opts)u[v]=n.opts[v];u.init();return u};return d});
+define("sprites/composite",["util/js","sprites/sprite"],function(a,d){function c(b,a,c,f,d){this.sn=b;this.x=a;this.y=c;this.endCallback=d;this.active=!0;this.sprites=[]}var b=a.copyProps,f=a.clone;c.prototype.init=function(){};c.prototype.addSprite=function(a,c,g,l,p,m){void 0===m&&(m={});a=this.sn.spriteDefs[a];var q=m.updates;if(void 0!==q)for(var q=Array(m.updates.length),n=0;n<m.updates.length;n++)q[n]=new this.sn.spriteUpdaters[m.updates[n].name],b(m.updates[n],q[n]);m=f(m);m.updates=q;g=new d(this.sn,
+a,g,l,p,m);g.setState(c);if(void 0!==m.opts)for(var t in m.opts)g[t]=m.opts[t];g.init();this.sprites.push(g);return g};c.prototype.isActive=function(b){if(!this.active)return!1;for(var a=!1,c=this.sprites.length-1;0<=c;c--)this.sprites[c].isActive(b)?a=!0:this.sprites.splice(c,1);this.active=a;!this.active&&void 0!==this.endCallback&&this.endCallback();return a};c.prototype.update=function(b,a){for(var c=this.sprites.length-1;0<=c;c--)void 0!==a&&a(this.sprites[c],b),this.sprites[c].update()};c.prototype.draw=
function(b,a,c,f){if(this.active){a=this.x-a;c=this.y-c;for(var d=0;d<this.sprites.length;d++){var m=this.sprites[d];m.isActive(f)&&m.drawAt(b,a+m.x-m.def.y,c+m.y-m.h-m.def.y,f)}}};c.prototype.onRemove=function(){for(var b=this.sprites.length-1;0<=b;b--)this.sprites[b].onRemove()};return c});
define("util/preload",[],function(){function a(){this.imagebatch=[];this.audiobatch=[];this.errorstate=!1}var d=[{ext:".ogg",mime:'audio/ogg; codecs="vorbis"'},{ext:".mp3",mime:"audio/mpeg"}],c;a.prototype.addAudio=function(b,a,e){if(void 0===c)for(var h=new Audio,g=0;g<d.length;g++){var l=d[g];if(h.canPlayType(l.mime)){c=l.ext;break}}this.audiobatch.push({file:b+c,tag:a,fnStore:e})};a.prototype.addImage=function(b,a,c){this.imagebatch.push({file:b,tag:a,fnStore:c})};a.prototype.load=function(b,a,
-c){function d(c,e){return function(){n.errorstate||(l--,void 0!==c.fnStore&&c.fnStore(e,c.tag),a(1-l/(n.imagebatch.length+n.audiobatch.length)),0===l&&b())}}function g(b){return function(a){n.errorstate||(n.errorstate=!0,c("Failed to load "+b.file))}}var l=this.imagebatch.length+this.audiobatch.length,n=this,m,q;a(0);for(m=0;m<this.imagebatch.length;m++){q=this.imagebatch[m];var p=new Image;p.onload=d(q,p);p.onerror=g(q);p.src=q.file}for(m=0;m<this.audiobatch.length;m++)q=this.audiobatch[m],p=new Audio,
-p.addEventListener("canplaythrough",d(q,p)),p.onerror=g(q),p.src=q.file};return a});define("util/rnd",[],function(){var a=function(b,a){return b+Math.random()*(a-b+1)|0},d=function(b,a){return b+Math.random()*(a-b+1)},c=function(b,a,c,d){var g=[];for(c=c||1E4;0<c;c--)g.push(d(b,a));var l=0;return function(){l++;l===g.length&&(l=0);return g[l]}};return{rnd:a,rndFloat:d,fastRand:function(b,f,d){return c(b,f,d,a)},fastRandFloat:function(b,a,e){return c(b,a,e,d)}}});
+c){function d(c,e){return function(){p.errorstate||(l--,void 0!==c.fnStore&&c.fnStore(e,c.tag),a(1-l/(p.imagebatch.length+p.audiobatch.length)),0===l&&b())}}function g(b){return function(a){p.errorstate||(p.errorstate=!0,c("Failed to load "+b.file))}}var l=this.imagebatch.length+this.audiobatch.length,p=this,m,q;a(0);for(m=0;m<this.imagebatch.length;m++){q=this.imagebatch[m];var n=new Image;n.onload=d(q,n);n.onerror=g(q);n.src=q.file}for(m=0;m<this.audiobatch.length;m++)q=this.audiobatch[m],n=new Audio,
+n.addEventListener("canplaythrough",d(q,n)),n.onerror=g(q),n.src=q.file};return a});define("util/rnd",[],function(){var a=function(b,a){return b+Math.random()*(a-b+1)|0},d=function(b,a){return b+Math.random()*(a-b+1)},c=function(b,a,c,d){var g=[];for(c=c||1E4;0<c;c--)g.push(d(b,a));var l=0;return function(){l++;l===g.length&&(l=0);return g[l]}};return{rnd:a,rndFloat:d,fastRand:function(b,f,d){return c(b,f,d,a)},fastRandFloat:function(b,a,e){return c(b,a,e,d)}}});
define("util/bitmap",[],function(){return{imageToData:function(a,d,c,b,f){var e=a.width,h=a.height,g=document.createElement("canvas");g.height=h;g.width=e;g=g.getContext("2d");g.drawImage(a,0,0);a=g.getImageData(0,0,e,h).data;e=a.length/4;d&&(d.length=e);c&&(c.length=e);b&&(b.length=e);f&&(f.length=e);for(h=0;h<e;h++)d&&(d[h]=a[4*h]),c&&(c[h]=a[4*h+1]),b&&(b[h]=a[4*h+2]),f&&(f[h]=a[4*h+3])}}});
define("util/debug",[],function(){return{debugText:function(a,d,c,b){a.fillStyle="black";a.font="bold 16px Arial";a.fillText(d,c+1,b);a.fillText(d,c-1,b);a.fillText(d,c,b+1);a.fillText(d,c,b-1);a.fillStyle="white";a.fillText(d,c,b)}}});
define("util/minheap",[],function(){function a(){this.heap=[];this.left=function(a){return 2*a+1};this.right=function(a){return 2*a+2};this.parent=function(a){return Math.ceil(a/2)-1};this.heapify=function(a){var c=this.left(a),b=this.right(a),c=c<this.heap.length&&this.heap[c].priority<this.heap[a].priority?c:a;b<this.heap.length&&this.heap[b].priority<this.heap[c].priority&&(c=b);a!==c&&(b=this.heap[c],this.heap[c]=this.heap[a],this.heap[a]=b,this.heapify(c))};this.siftUp=function(a){var c=this.parent(a);
if(0<=c&&this.heap[c].priority>this.heap[a].priority){var b=this.heap[c];this.heap[c]=this.heap[a];this.heap[a]=b;this.siftUp(c)}}}a.prototype.push=function(a){this.heap.push(a);this.siftUp(this.heap.length-1)};a.prototype.pop=function(){var a;1<this.heap.length?(a=this.heap[0],this.heap[0]=this.heap.pop(),this.heapify(0)):a=this.heap.pop();return a};a.prototype.peek=function(){return this.heap[0]};a.prototype.size=function(){return this.heap.length};a.prototype.clear=function(){this.heap.length=
0;return this};return a});define("util/stats",[],function(){function a(){this.samples={};this.totals={};this.averages={}}a.prototype.count=function(a,c){var b,f;this.samples.hasOwnProperty(a)?(f=this.totals[a],b=this.samples[a]):(b=[],f=0,this.samples[a]=b);b.push(c);f+=c;10<b.length&&(f-=b[0],b.splice(0,1));this.totals[a]=f;this.averages[a]=f/b.length};return a});define("util/uid",[],function(){var a=1;return function(){return a++}});
define("util/clock",[],function(){function a(){}a.prototype.now=function(){return+new Date};a.prototype.fixedOutput=function(){this.now=function(){return+new Date}};return new a});define("util/url",[],function(){return{queryStringValue:function(a){return(a=RegExp("[?&]"+a+"=([^&]*)").exec(window.location.search))&&decodeURIComponent(a[1].replace(/\+/g," "))}}});
-define("util/all","util/preload util/rnd util/bitmap util/debug util/js util/minheap util/stats util/uid util/clock util/url".split(" "),function(a,d,c,b,f,e,h,g,l,n){return{Preloader:a,rnd:d,js:f,MinHeap:e,Stats:h,uid:g,clock:l,debug:b,Bitmap:c,Url:n}});
-define("map/tile",["util/uid","util/js"],function(a,d){function c(b,a,c,d,l,n,m,q,p){this.img=b;this.x=a;this.y=c;this.w=d;this.h=l;this.xoverdraw=n;this.yoverdraw=m;this.defaultProps=q||{};this.properties=p||{}}var b=d.copyProps;c.prototype.draw=function(b,a,c){b.drawImage(this.img,this.x,this.y,this.w,this.h,a-this.xoverdraw,c-this.yoverdraw,this.w,this.h)};c.prototype.getProperty=function(b){if(this.properties.hasOwnProperty(b))return this.properties[b];if(this.defaultProps.hasOwnProperty(b))return this.defaultProps[b]};
+define("util/all","util/preload util/rnd util/bitmap util/debug util/js util/minheap util/stats util/uid util/clock util/url".split(" "),function(a,d,c,b,f,e,h,g,l,p){return{Preloader:a,rnd:d,js:f,MinHeap:e,Stats:h,uid:g,clock:l,debug:b,Bitmap:c,Url:p}});
+define("map/tile",["util/uid","util/js"],function(a,d){function c(b,a,c,d,l,p,m,q,n){this.img=b;this.x=a;this.y=c;this.w=d;this.h=l;this.xoverdraw=p;this.yoverdraw=m;this.defaultProps=q||{};this.properties=n||{}}var b=d.copyProps;c.prototype.draw=function(b,a,c){b.drawImage(this.img,this.x,this.y,this.w,this.h,a-this.xoverdraw,c-this.yoverdraw,this.w,this.h)};c.prototype.getProperty=function(b){if(this.properties.hasOwnProperty(b))return this.properties[b];if(this.defaultProps.hasOwnProperty(b))return this.defaultProps[b]};
c.prototype.getProperties=function(b){for(var a={},c=b.length-1;0<=c;c--){var d=b[c];this.properties.hasOwnProperty(d)?a[d]=this.properties[d]:this.defaultProps.hasOwnProperty(d)?a[d]=this.defaultProps[d]:a[d]=void 0}return a};c.prototype.setProperty=function(b,a){this.properties[b]=a};c.prototype.setProperties=function(a){b(a,this.properties)};return c});
-define("map/staggered-isometric",["map/tile","util/bitmap","util/debug","util/js","util/clock"],function(a,d,c,b,f){function e(b,a,c,f,d){this.data=b;this.hitTests=a;this.maxYOverdraw=this.maxXOverdraw=0;this.clientWidth=c;this.clientHeight=f;this.hideBuildings=!1;this.type=this.data.orientation;this.minxoffset=this.data.tilewidth/2;this.minyoffset=this.data.tileheight/2;this.maxxoffset=this.data.width*this.data.tilewidth-this.clientWidth-1;this.maxyoffset=this.data.height*(this.data.tileheight/2)-
-this.clientHeight-1;this.xoffset=this.minxoffset;this.yoffset=this.maxyoffset;this.stats=d}var h=c.debugText,g=b.setProps,l=[0,0];e.prototype.isStaggered=function(){return"staggered"===this.type};e.prototype.isOrthogonal=function(){return"orthogonal"===this.type};e.prototype.tileDimensions=function(b){b[0]=this.data.tilewidth;b[1]=this.data.tileheight};e.prototype.primePreloader=function(b){for(var a=this.data,c=this,f=function(b,a){a.image=b},e=0;e<a.tilesets.length;e++){var g=a.tilesets[e];b.addImage(g.image,
+define("map/staggered-isometric",["map/tile","util/bitmap","util/debug","util/js","util/clock"],function(a,d,c,b,f){function e(b,a,c,f,e){this.data=b;this.hitTests=a;this.maxYOverdraw=this.maxXOverdraw=0;this.clientWidth=c;this.clientHeight=f;this.hideBuildings=!1;this.type=this.data.orientation;this.minxoffset=this.data.tilewidth/2;this.minyoffset=this.data.tileheight/2;this.maxxoffset=this.data.width*this.data.tilewidth-this.clientWidth-1;this.maxyoffset=this.data.height*(this.data.tileheight/2)-
+this.clientHeight-1;this.xoffset=this.minxoffset;this.yoffset=this.maxyoffset;this.stats=e}var h=c.debugText,g=b.setProps,l=[0,0];e.prototype.isStaggered=function(){return"staggered"===this.type};e.prototype.isOrthogonal=function(){return"orthogonal"===this.type};e.prototype.tileDimensions=function(b){b[0]=this.data.tilewidth;b[1]=this.data.tileheight};e.prototype.primePreloader=function(b){for(var a=this.data,c=this,f=function(b,a){a.image=b},e=0;e<a.tilesets.length;e++){var g=a.tilesets[e];b.addImage(g.image,
g,f)}var f=function(b,f){if(b.width!==a.tilewidth||b.height!==a.tileheight)throw"Hit test image "+f+" does not match map tile size";if("hit"===f){c.hitTest=[];c.edgeNormals=[];c.worldEdgeDistance=[];d.imageToData(b,c.hitTest,c.edgeNormals,c.worldEdgeDistance);c.edgeNormalsX=Array(c.edgeNormals.length);c.edgeNormalsY=Array(c.edgeNormals.length);for(var e=c.edgeNormals.length-1;0<=e;e--){var m=c.edgeNormals[e],m=3*m*Math.PI/180;c.edgeNormals[e]=m;c.edgeNormalsX[e]=Math.cos(m);c.edgeNormalsY[e]=-Math.sin(m)}}},
-h;for(h in this.hitTests)b.addImage(this.hitTests[h],h,f)};var n=function(b){if(void 0===b)return b;for(var a in b)"height"===a&&"string"===typeof b[a]&&(b[a]=parseInt(b[a],10));return b};e.prototype.getTile=function(b,a,c){b=b.rows;if(0>a||0>c||c>=b.length)return null;c=b[c];return a>=c.length?null:c[a]};e.prototype.resolveTiles=function(){var b,c,f,e,d,g=this.data;for(f=g.tilesets.length-1;0<=f;f--)e=g.tilesets[f],e.xspan=Math.floor(e.imagewidth/e.tilewidth),e.yspan=Math.floor(e.imageheight/e.tileheight);
+h;for(h in this.hitTests)b.addImage(this.hitTests[h],h,f)};var p=function(b){if(void 0===b)return b;for(var a in b)"height"===a&&"string"===typeof b[a]&&(b[a]=parseInt(b[a],10));return b};e.prototype.getTile=function(b,a,c){b=b.rows;if(0>a||0>c||c>=b.length)return null;c=b[c];return a>=c.length?null:c[a]};e.prototype.resolveTiles=function(){var b,c,f,e,d,g=this.data;for(f=g.tilesets.length-1;0<=f;f--)e=g.tilesets[f],e.xspan=Math.floor(e.imagewidth/e.tilewidth),e.yspan=Math.floor(e.imageheight/e.tileheight);
for(b=this.columns=this.rows=0;b<g.layers.length;b++){var h=g.layers[b];this.columns=Math.max(this.columns,h.width);h.rows=[];var l=[];for(c=0;c<h.data.length;c++){var w=h.data[c];if(0===w)l.push(null);else{for(f=g.tilesets.length-1;0<=f&&!(e=g.tilesets[f],e.firstgid<=w);f--);f=w-e.firstgid;var w=Math.floor(f/e.xspan),u=f-e.xspan*w;d=e.tileheight-g.tileheight;this.maxXOverdraw=Math.max(e.tilewidth-g.tilewidth,this.maxXOverdraw);this.maxYOverdraw=Math.max(d,this.maxYOverdraw);d=void 0;void 0!==e.tileproperties&&
-e.tileproperties.hasOwnProperty(f)&&(d=e.tileproperties[f]);l.push(new a(e.image,u*e.tilewidth,w*e.tileheight,e.tilewidth,e.tileheight,e.tilewidth-g.tilewidth,e.tileheight-g.tileheight,n(e.properties),n(d)))}l.length>=h.width&&(h.rows.push(l),this.rows=Math.max(this.rows,l.length),l=[])}}};e.prototype.drawDebugRegions=function(b,a){var c=this.data,f,e,d,g,l,n=c.tilewidth,u=c.tileheight/2;g=Math.floor((this.yoffset-u)/u);d=Math.floor((this.yoffset+this.clientHeight-u+this.maxYOverdraw)/u)+1;var v=
-Math.floor((this.xoffset+this.clientWidth-1)/n);l=Math.floor((this.xoffset-n/2-this.maxXOverdraw)/n);f=c.layers[0];f=Math.min(d,f.rows.length-1);for(e=Math.max(l,0);g<=f;g++){l=g&1?c.tilewidth/2:0;for(d=v;d>=e;d--){var z=Math.floor(-this.xoffset)+l+d*n,A=Math.floor(-this.yoffset)+g*u,x=c.tilewidth,D=c.tileheight;b.strokeStyle="#aaa";b.beginPath();b.moveTo(z,A+D/2);b.lineTo(z+x/2,A);b.lineTo(z+x,A+D/2);b.lineTo(z+x/2,A+D);b.closePath();b.stroke()}}f=c.layers[0];for(g=0;g<f.rows.length;g++){d=f.rows[g];
-l=g&1?c.tilewidth/2:0;for(d=d.length-1;0<=d;d--)if(0<a.length){v=[];e=this.getTilePropsAtTilePos(a,d,g);for(z=0;z<a.length;z++)v.push(e[a[z]]);h(b,v.join(),85+Math.floor(-this.xoffset)+l+d*n,55+Math.floor(-this.yoffset)+g*u)}else h(b,d+","+g,85+Math.floor(-this.xoffset)+l+d*n,55+Math.floor(-this.yoffset)+g*u)}};e.prototype.scrollTo=function(b,a){this.xoffset=b;this.yoffset=a;this.xoffset<this.minxoffset?this.xoffset=this.minxoffset:this.xoffset>this.maxxoffset&&(this.xoffset=this.maxxoffset);this.yoffset<
+e.tileproperties.hasOwnProperty(f)&&(d=e.tileproperties[f]);l.push(new a(e.image,u*e.tilewidth,w*e.tileheight,e.tilewidth,e.tileheight,e.tilewidth-g.tilewidth,e.tileheight-g.tileheight,p(e.properties),p(d)))}l.length>=h.width&&(h.rows.push(l),this.rows=Math.max(this.rows,l.length),l=[])}}};e.prototype.drawDebugRegions=function(b,a){var c=this.data,f,e,d,g,l,p=c.tilewidth,u=c.tileheight/2;g=Math.floor((this.yoffset-u)/u);d=Math.floor((this.yoffset+this.clientHeight-u+this.maxYOverdraw)/u)+1;var v=
+Math.floor((this.xoffset+this.clientWidth-1)/p);l=Math.floor((this.xoffset-p/2-this.maxXOverdraw)/p);f=c.layers[0];f=Math.min(d,f.rows.length-1);for(e=Math.max(l,0);g<=f;g++){l=g&1?c.tilewidth/2:0;for(d=v;d>=e;d--){var z=Math.floor(-this.xoffset)+l+d*p,A=Math.floor(-this.yoffset)+g*u,x=c.tilewidth,D=c.tileheight;b.strokeStyle="#aaa";b.beginPath();b.moveTo(z,A+D/2);b.lineTo(z+x/2,A);b.lineTo(z+x,A+D/2);b.lineTo(z+x/2,A+D);b.closePath();b.stroke()}}f=c.layers[0];for(g=0;g<f.rows.length;g++){d=f.rows[g];
+l=g&1?c.tilewidth/2:0;for(d=d.length-1;0<=d;d--)if(0<a.length){v=[];e=this.getTilePropsAtTilePos(a,d,g);for(z=0;z<a.length;z++)v.push(e[a[z]]);h(b,v.join(),85+Math.floor(-this.xoffset)+l+d*p,55+Math.floor(-this.yoffset)+g*u)}else h(b,d+","+g,85+Math.floor(-this.xoffset)+l+d*p,55+Math.floor(-this.yoffset)+g*u)}};e.prototype.scrollTo=function(b,a){this.xoffset=b;this.yoffset=a;this.xoffset<this.minxoffset?this.xoffset=this.minxoffset:this.xoffset>this.maxxoffset&&(this.xoffset=this.maxxoffset);this.yoffset<
this.minyoffset?this.yoffset=this.minyoffset:this.yoffset>this.maxyoffset&&(this.yoffset=this.maxyoffset)};e.prototype.scroll=function(b,a){this.scrollTo(this.xoffset+b,this.yoffset+a)};e.prototype.getWorldEdges=function(){return{le:this.minxoffset,te:this.minyoffset,re:this.maxxoffset+this.clientWidth,be:this.maxyoffset+this.clientHeight}};e.prototype.worldToTilePos=function(b,a,c){var f=this.data,e=f.tilewidth,f=f.tileheight;b|=0;a|=0;var d=this.hitTest[Math.floor(b%e)+Math.floor(a%f)*e];if(128<=
d)return c[0]=((b+e)/e|0)-1,c[1]=2*(((a+f)/f|0)-1),d-128;c[0]=((b+e/2)/e|0)-1;c[1]=2*((a+f/2)/f|0)-1;return d};e.prototype.worldEdgeNormal=function(b,a,c){var f=this.data,e=f.tilewidth,f=f.tileheight;b=Math.floor((b|0)%e)+Math.floor((a|0)%f)*e;a=this.worldEdgeDistance[b];c[0]=this.edgeNormalsX[b];c[1]=this.edgeNormalsY[b];return 128<=a?a-128:a};e.prototype.getTilePropsAtTilePos=function(b,a,c){for(var f=this.data.layers,e,d,h="string"!==typeof b,l=f.length-1;0<=l;l--)if(e=f[l].rows,void 0!==e&&(0<=
-c&&c<e.length)&&(e=e[c][a]))if(h)e=e.getProperties(b),d?g(e,d):d=e;else if(e=e.getProperty(b),void 0!==e)return e;return h?d:void 0};e.prototype.setTilePropsAtTilePos=function(b,a,c,f){for(var e=this.data.layers,d=e.length-1;0<=d;d--){var g=e[d].rows;if(void 0!==g&&(0<=f&&f<g.length)&&(g=g[f][c])){"string"===typeof b?g.setProperty(b,a):g.setProperties(b);break}}};e.prototype.getTilePropsAtWorldPos=function(b,a,c){this.worldToTilePos(a,c,l);return this.getTilePropsAtTilePos(b,l[0],l[1])};e.prototype.screenToTilePos=
+c&&c<e.length)&&(e=e[c][a]))if(h)e=e.getProperties(b),d?g(e,d):d=e;else if(e=e.getProperty(b),void 0!==e)return e;return h?d:void 0};e.prototype.setTilePropsAtTilePos=function(b,a,c,e){for(var f=this.data.layers,d=f.length-1;0<=d;d--){var g=f[d].rows;if(void 0!==g&&(0<=e&&e<g.length)&&(g=g[e][c])){"string"===typeof b?g.setProperty(b,a):g.setProperties(b);break}}};e.prototype.getTilePropsAtWorldPos=function(b,a,c){this.worldToTilePos(a,c,l);return this.getTilePropsAtTilePos(b,l[0],l[1])};e.prototype.screenToTilePos=
function(b,a,c){return this.worldToTilePos(b+this.xoffset,a+this.yoffset,c)};e.prototype.screenToWorldPos=function(b,a,c){c[0]=b+this.xoffset;c[1]=a+this.yoffset};e.prototype.worldToScreenPos=function(b,a,c){c[0]=b-this.xoffset;c[1]=a-this.yoffset};e.prototype.insertLayer=function(b,a){this.data.layers.splice(b,0,a)};e.prototype.updateLayers=function(b){for(var a=f.now(),c=this.data,e=0;e<c.layers.length;e++){var d=c.layers[e];d.hasOwnProperty("update")&&d.update(b)}this.stats.count("updateLayers",
-f.now()-a)};e.prototype.groundLayer=function(){for(var b=this.data,a=0;a<b.layers.length;a++){var c=b.layers[a];if(!("draw"in c)&&c.visible)return c}};e.prototype.onResize=function(b,a){this.clientWidth=b;this.clientHeight=a;this.maxxoffset=this.data.width*this.data.tilewidth-this.clientWidth-1;this.maxyoffset=this.data.height*(this.data.tileheight/2)-this.clientHeight-1};e.prototype.drawWorld=function(b,a,c){var e=this.data,d,g=e.tilewidth,h=e.tileheight/2,l=Math.floor((this.yoffset-h)/h),n=Math.floor((this.yoffset+
-this.clientHeight-h+this.maxYOverdraw)/h)+1,u=Math.floor((this.xoffset+this.clientWidth-1)/g),v=Math.floor((this.xoffset-g/2-this.maxXOverdraw)/g);d=f.now();c.sort(function(b,a){var c=b.y-a.y;if(0!==c)return c;c=b.h-a.h;return 0!==c?c:b.nuid-a.nuid});this.stats.count("spriteSort",f.now()-d);d=f.now();var z=0,A=0,x,D,k,C,G,I,E,H=e.layers.length-1;for(G=0;G<e.layers.length;G++){C=e.layers[G];var J=!this.hideBuildings||G!==H;if("draw"in C)C.draw(b,a);else if(C.visible){I=Math.min(n,C.rows.length-1);
+f.now()-a)};e.prototype.groundLayer=function(){for(var b=this.data,a=0;a<b.layers.length;a++){var c=b.layers[a];if(!("draw"in c)&&c.visible)return c}};e.prototype.onResize=function(b,a){this.clientWidth=b;this.clientHeight=a;this.maxxoffset=this.data.width*this.data.tilewidth-this.clientWidth-1;this.maxyoffset=this.data.height*(this.data.tileheight/2)-this.clientHeight-1};e.prototype.drawWorld=function(b,a,c){var e=this.data,d,g=e.tilewidth,h=e.tileheight/2,l=Math.floor((this.yoffset-h)/h),p=Math.floor((this.yoffset+
+this.clientHeight-h+this.maxYOverdraw)/h)+1,u=Math.floor((this.xoffset+this.clientWidth-1)/g),v=Math.floor((this.xoffset-g/2-this.maxXOverdraw)/g);d=f.now();c.sort(function(b,a){var c=b.y-a.y;if(0!==c)return c;c=b.h-a.h;return 0!==c?c:b.nuid-a.nuid});this.stats.count("spriteSort",f.now()-d);d=f.now();var z=0,A=0,x,D,k,C,G,I,E,H=e.layers.length-1;for(G=0;G<e.layers.length;G++){C=e.layers[G];var J=!this.hideBuildings||G!==H;if("draw"in C)C.draw(b,a);else if(C.visible){I=Math.min(p,C.rows.length-1);
E=Math.max(v,0);for(D=l;D<=I;D++){k=C.rows[D];A=D&1?e.tilewidth/2:0;for(x=u;x>=E;x--){var F=k[x];null!==F&&J&&F.draw(b,Math.floor(-this.xoffset)+A+x*g,Math.floor(-this.yoffset)+D*h)}if(G===H)for(A=(D+2)*h;z<c.length&&A>=c[z].y;)c[z++].draw(b,this.xoffset,this.yoffset,a)}}}this.stats.count("paintWorld",f.now()-d)};return e});
define("input/keyboard",[],function(){return function(){var a=this;this.keymap={backspace:8,tab:9,enter:13,pause:19,capsLock:20,escape:27,space:32,pageUp:33,pageDown:34,end:35,home:36,left:37,up:38,right:39,down:40,ins:45,del:46,plus:187,comma:188,minus:189,period:190,shift:16,ctrl:17,alt:18,zero:48,one:49,two:50,three:51,four:52,five:53,six:54,seven:55,eight:56,nine:57,a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,
num0:96,num1:97,num2:98,num3:99,num4:100,num5:101,num6:102,num7:103,num8:104,num9:105,multiply:106,add:107,substract:109,decimal:110,divide:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123};this.actions=[];this.keys=[];this.bind=function(d,c){a.actions[c]=0;a.keys[a.keymap[d]]=c};this.actionPressed=function(d){return!!a.actions[d]};window.addEventListener("keydown",function(d){var c=d.target.tagName;"keydown"!==d.type||("INPUT"===c||"TEXTAREA"===c)||(d.preventDefault(),
d=d.keyCode,(c=a.keys[d])&&a.actions[c]!==d&&(a.actions[c]=d))},!1);window.addEventListener("keyup",function(d){"keyup"===d.type&&(d.preventDefault(),(d=a.keys[d.keyCode])&&(a.actions[d]=0))},!1)}});define("input/mouse",[],function(){return function(a){var d=this;this.y=this.x=0;this.inputmap={mouse1:-1,mouse2:-3,wheelUp:-4,wheelDown:-5};a.addEventListener("mousemove",function(c){var b=a.getBoundingClientRect();d.x=c.clientX-b.left;d.y=c.clientY-b.top},!1)}});
-define("input/ui/button",[],function(){function a(a){this.sn=a;this.y=this.x=0;this.sprite=void 0;this.inactiveState="inactive";this.activeState="active";this.hoverState="hover";this.disabledState="disabled"}a.prototype.draw=function(a,c,b,f){this.sprite.isActive(f);this.sprite.draw(a,c-this.x,b-this.y,f)};return a});
-define("input/ui/panel",["util/uid","input/ui/button","sprites/sprite"],function(a,d,c){function b(f,e){this.sn=f;this.id=a();this.children=[];this.y=this.x=0;if(e){this.x=e.x;this.y=e.y;for(var h=0;h<e.children.length;h++){var g=e.children[h],l=0,n;for(n in g){l++;if(1<l)throw"Multiple types in UI element definition. Unexpected "+n;var m=g[n];if("sprite"===n){var q;q=m.def;var p=q.split(":");if(2!==p.length)throw"Badly formed sprite ref: '"+q+"'";q=p;m=c.construct(f,q[0],q[1],void 0,m.x,m.y,0,{});
-this.children.push(m)}else if("button"===n){q=new d;q.x=m.x;q.y=m.y;if(!f.spriteStateExists(m.sprite,"inactive"))throw"Buttons must have at least an inactive state";f.spriteStateExists(m.sprite,"active")||(q.activeState="inactive");f.spriteStateExists(m.sprite,"hover")||(q.hoverState="inactive");f.spriteStateExists(m.sprite,"disabled")||(q.disabledState="inactive");q.sprite=c.construct(f,m.sprite,"inactive",void 0,0,0,0,{maxloops:1,autoRemove:!1});this.children.push(q)}else"panel"===n&&this.children.push(new b(f,
-m))}}}}b.prototype.show=function(b){void 0===b&&(b=!0);b?this.sn.activatePanel(this):this.sn.deactivatePanel(this);return this};b.prototype.hide=function(){this.show(!1);return this};b.prototype.center=function(b,a){void 0===b&&(b=!0);void 0===a&&(a=!0);b&&this.height&&(this.y=(this.sn.clientHeight-this.height)/2|0);a&&this.width&&(this.x=(this.sn.clientWidth-this.width)/2|0);return this};b.prototype.draw=function(a,e,h,g){h=(h||0)+this.x;g=(g||0)+this.y;for(var l=this.children.length,n=0;n<l;n++){var m=
-this.children[n];if(m instanceof b)m.draw(a,e,h,g);else if(m instanceof c)m.isActive(a),m.draw(e,-h,-g,a);else if(m instanceof d)m.draw(e,-h,-g,a);else throw"Can't draw "+m;}};return b});define("input/ui/label",[],function(){return function(a){this.sn=a}});define("input/all",["input/keyboard","input/mouse","input/ui/panel","input/ui/label","input/ui/button"],function(a,d,c,b,f){return{Keyboard:a,Mouse:d,Panel:c,Label:b,Button:f}});
+define("input/ui/button",[],function(){function a(a){this.sn=a;this.y=this.x=0;this.sprite=void 0;this.inactiveState="inactive";this.activeState="active";this.hoverState="hover";this.disabledState="disabled"}a.prototype.draw=function(a,c,b,f){this.sprite.isActive(f);this.sprite.draw(a,c-this.x,b-this.y,f)};return a});define("input/ui/label",[],function(){return function(a){this.sn=a}});
+define("input/ui/panel",["util/uid","input/ui/button","input/ui/label","sprites/sprite"],function(a,d,c,b){function f(c,h){this.sn=c;this.id=a();this.children=[];this.y=this.x=0;if(h){this.x=h.x;this.y=h.y;for(var g=0;g<h.children.length;g++){var l=h.children[g],p=0,m;for(m in l){p++;if(1<p)throw"Multiple types in UI element definition. Unexpected "+m;var q=l[m];if("sprite"===m){var n;n=q.def;var t=n.split(":");if(2!==t.length)throw"Badly formed sprite ref: '"+n+"'";n=t;q=b.construct(c,n[0],n[1],
+void 0,q.x,q.y,0,{});this.children.push(q)}else if("button"===m){n=new d;n.x=q.x;n.y=q.y;if(!c.spriteStateExists(q.sprite,"inactive"))throw"Buttons must have at least an inactive state";c.spriteStateExists(q.sprite,"active")||(n.activeState="inactive");c.spriteStateExists(q.sprite,"hover")||(n.hoverState="inactive");c.spriteStateExists(q.sprite,"disabled")||(n.disabledState="inactive");n.sprite=b.construct(c,q.sprite,"inactive",void 0,0,0,0,{maxloops:1,autoRemove:!1});this.children.push(n)}else"panel"===
+m&&this.children.push(new f(c,q))}}}}f.prototype.show=function(b){void 0===b&&(b=!0);b?this.sn.activatePanel(this):this.sn.deactivatePanel(this);return this};f.prototype.hide=function(){this.show(!1);return this};f.prototype.center=function(b,a){void 0===b&&(b=!0);void 0===a&&(a=!0);b&&this.height&&(this.y=(this.sn.clientHeight-this.height)/2|0);a&&this.width&&(this.x=(this.sn.clientWidth-this.width)/2|0);return this};f.prototype.draw=function(a,h,g,l){g=(g||0)+this.x;l=(l||0)+this.y;for(var p=this.children.length,
+m=0;m<p;m++){var q=this.children[m];if(q instanceof f)q.draw(a,h,g,l);else if(q instanceof b)q.isActive(a),q.draw(h,-g,-l,a);else if(q instanceof d)q.draw(h,-g,-l,a);else if(!(q instanceof c))throw"Can't draw "+q;}};return f});define("input/all",["input/keyboard","input/mouse","input/ui/panel","input/ui/label","input/ui/button"],function(a,d,c,b,f){return{Keyboard:a,Mouse:d,Panel:c,Label:b,Button:f}});
define("plugins/sprite/bounce",[],function(){function a(){}var d;a.prototype.update=function(a,b){var f=this.sprite,e=f.state.jogPos(f.epoch,d.getNow()),e=2*e-1,e=e*e;f.h=this.bounce_base+this.bounce_height*(1-e);return!0};a.prototype.init=function(a){this.sprite=a};a.prototype.onSpriteRemoved=function(){};return function(c){d=c;d.registerSpriteUpdater("bounce",a)}});
define("plugins/sprite/follow-mouse",[],function(){function a(){}var d=[0,0],c;a.prototype.update=function(b,a){c.mouseWorldPos(d);var e=this.sprite;e.x=d[0];e.y=d[1];return!0};a.prototype.init=function(b){this.sprite=b};a.prototype.onSpriteRemoved=function(){};return function(b){c=b;c.registerSpriteUpdater("follow_mouse",a)}});
define("plugins/sprite/animate",[],function(){function a(){}var d;a.prototype.update=function(a,b){var f=this.sprite,e=a-this.epoch,d;for(d in this.props)f[d]=this.tweenfn(e,this.begin[d],this.props[d],this.duration);return!0};a.prototype.init=function(a){this.sprite=a;void 0===this.duration&&(this.duration=a.maxDuration());this.begin={};for(var b in this.props)this.begin[b]=a[b];this.duration=Math.max(this.duration,1);if(!d.tweens.hasOwnProperty(this.tween))throw"Unrecognized tween in animate plugin: "+
@@ -58,14 +58,14 @@ define("plugins/sprite/8way",[],function(){function a(){}var d;a.prototype.updat
for(d=this.jitterBuffer.length-1;0<=d;d--)if(this.jitterBuffer[d]===this.direction)return!0;this.jitterBuffer=Array(this.anti_jitter)}this.direction=e;f.morphState(f.stateName,this.direction);return!0};a.prototype.init=function(a){this.sprite=a;this.direction="e";this.anti_jitter&&(this.jitterBuffer=Array(this.anti_jitter))};a.prototype.onSpriteRemoved=function(){};return function(c){d=c;d.registerSpriteUpdater("8way",a)}});
define("plugins/sprite/track",[],function(){function a(){}var d;a.prototype.update=function(a,b){var f=this.sprite,e=f.x!==this.x||f.y!==this.y||f.h!==this.h;e&&(this.fn&&this.fn(f),this.x=f.x,this.y=f.y,this.h=f.h);this.always&&this.always(f,e);return!0};a.prototype.onSpriteRemoved=function(){this.deregister&&this.deregister(this.sprite)};a.prototype.init=function(a){this.sprite=a;this.x=a.x;this.y=a.y;this.h=a.h;this.register&&this.register(a)};return function(c){d=c;d.registerSpriteUpdater("track",
a)}});
-define("plugins/sprite/flock",[],function(){function a(){this.xy=[0,0];this.xy2=[0,0]}var d;a.prototype.update=function(a,b){var f,e,d;f=void 0===this.lastTime?16:a-this.lastTime;this.lastTime=a;var g=0,l=0,n,m,q,p,t,r=this.sprite,s=this.xy;d=this.xy2;var y=this.tracker.find(r.x,r.y,this.flock_neighborhood,!0);this.flock_steering(r,s);s[0]*=3;s[1]*=3;e=Math.min(this.flock_neighbor_limit,y.length);if(0<e){for(n=e-1;0<=n;n--)t=y[n],g+=t.x,l+=t.y;r.vectorTo(g/e,l/e,d);s[0]+=1*d[0];s[1]+=1*2*d[1]}if(0<e){l=
-g=0;for(n=e-1;0<=n;n--)t=y[n],g+=t.velocityx,l+=t.velocityy;g/=e;l=2*l/e;e=g*g+l*l;1.44<e&&(e=Math.sqrt(e),0<e&&(g=1.2*g/e,l=1.2*l/e));s[0]+=g;s[1]+=l}e=0;d=Math.min(this.flock_neighbor_limit,y.length);for(n=l=g=0;n<d;n++)if(t=y[n],r.nuid!==t.nuid){m=r.x-t.x;q=2*(r.y-t.y);p=m*m+q*q;if(p>this.flock_separation2)break;0===p&&(m=r.nuid>t.nuid?0.5:-0.5,p=0.25);e++;m/=p;q/=p;g+=m;l+=q}0<e&&(e=Math.sqrt(g*g+l*l),0<e&&(s[0]+=3*(g/e),s[1]+=3*(l/e)));r.velocityx=0.95*r.velocityx+s[0];r.velocityy=0.95*r.velocityy+
+define("plugins/sprite/flock",[],function(){function a(){this.xy=[0,0];this.xy2=[0,0]}var d;a.prototype.update=function(a,b){var f,e,d;f=void 0===this.lastTime?16:a-this.lastTime;this.lastTime=a;var g=0,l=0,p,m,q,n,t,r=this.sprite,s=this.xy;d=this.xy2;var y=this.tracker.find(r.x,r.y,this.flock_neighborhood,!0);this.flock_steering(r,s);s[0]*=3;s[1]*=3;e=Math.min(this.flock_neighbor_limit,y.length);if(0<e){for(p=e-1;0<=p;p--)t=y[p],g+=t.x,l+=t.y;r.vectorTo(g/e,l/e,d);s[0]+=1*d[0];s[1]+=1*2*d[1]}if(0<e){l=
+g=0;for(p=e-1;0<=p;p--)t=y[p],g+=t.velocityx,l+=t.velocityy;g/=e;l=2*l/e;e=g*g+l*l;1.44<e&&(e=Math.sqrt(e),0<e&&(g=1.2*g/e,l=1.2*l/e));s[0]+=g;s[1]+=l}e=0;d=Math.min(this.flock_neighbor_limit,y.length);for(p=l=g=0;p<d;p++)if(t=y[p],r.nuid!==t.nuid){m=r.x-t.x;q=2*(r.y-t.y);n=m*m+q*q;if(n>this.flock_separation2)break;0===n&&(m=r.nuid>t.nuid?0.5:-0.5,n=0.25);e++;m/=n;q/=n;g+=m;l+=q}0<e&&(e=Math.sqrt(g*g+l*l),0<e&&(s[0]+=3*(g/e),s[1]+=3*(l/e)));r.velocityx=0.95*r.velocityx+s[0];r.velocityy=0.95*r.velocityy+
s[1];f=this.flock_speed*f/1E3;e=r.velocityx*r.velocityx+r.velocityy*r.velocityy;e>f*f&&(e=Math.sqrt(e),1>e&&(e=1),r.velocityx=f*r.velocityx/e,r.velocityy=f*r.velocityy/e);0.01>r.velocityx&&(-0.01<r.velocityx&&0.01>r.velocityy&&-0.01<r.velocityy)&&(r.velocityy=r.velocityx=0);return!0};a.prototype.onSpriteRemoved=function(){};a.prototype.init=function(a){this.sprite=a;void 0===this.flock_speed&&(this.flock_speed=120);void 0===this.flock_neighborhood&&(this.flock_neighborhood=50);void 0===this.flock_separation&&
(this.flock_separation=Math.min(20,this.flock_neighborhood/2));this.flock_separation2=this.flock_separation*this.flock_separation;void 0===this.flock_neighbor_limit&&(this.flock_neighbor_limit=5)};return function(c){d=c;d.registerSpriteUpdater("flock",a)}});
define("plugins/sprite/apply-velocity",[],function(){function a(){}var d;a.prototype.update=function(a,b){var f=this.sprite;f.move(f.velocityx,f.velocityy/2)&&void 0!==this.on_collision&&this.on_collision.call(f);return!0};a.prototype.init=function(a){this.sprite=a};a.prototype.onSpriteRemoved=function(){};return function(c){d=c;d.registerSpriteUpdater("apply-velocity",a)}});
define("plugins/layer/ui",[],function(){function a(a,b){this.opts=b||{};this.name=a}var d;a.prototype.update=function(a){};a.prototype.draw=function(a,b){};return function(c){d=c;d.registerLayerPlugin("ui",a)}});
define("plugins/layer/ground-sprites",["sprites/sprite","util/uid"],function(a,d){function c(a,b){this.opts=b||{};this.name=a;this.sprites=[];this.spriteMap={}}var b;c.prototype.update=function(a){};c.prototype.draw=function(a,c){for(var d=b.map,g=this.sprites.length-1;0<=g;g--)this.sprites[g].draw(a,d.xoffset,d.yoffset,c)};c.prototype.purgeAll=function(){for(var a=this.sprites.length-1;0<=a;a--)this.sprites[a].onRemove();this.sprites=[];this.spriteMap={}};c.prototype.spawnSprite=function(c,e,h,g,
-l,n){n=n||{};if(void 0===n.id)n.id=d();else if(b.spriteMap.hasOwnProperty(n.id))throw"Error: duplicate sprite id "+n.id;c=a.construct(b,c,e,h,g,l,0,n);this.sprites.push(c);return this.spriteMap[n.id]=c};return function(a){b=a;b.registerLayerPlugin("ground-sprites",c)}});
+l,p){p=p||{};if(void 0===p.id)p.id=d();else if(b.spriteMap.hasOwnProperty(p.id))throw"Error: duplicate sprite id "+p.id;c=a.construct(b,c,e,h,g,l,0,p);this.sprites.push(c);return this.spriteMap[p.id]=c};return function(a){b=a;b.registerLayerPlugin("ground-sprites",c)}});
define("plugins/fx/particles",["sprites/sprite","sprites/composite","util/rnd"],function(a,d,c){function b(a){this.opts=a;var b="number"===typeof a.number?a.number:a.number(),c="function"===typeof a.x?a.x():a.x,d="function"===typeof a.y?a.y():a.y;this.duration="function"===typeof a.duration?a.duration():a.duration;this.epoch=f.getNow();this.endCallback=a.endCallback;for(this.comp=f.createComposite(c,d,a.id);0<b--;)c=a.spritePos||{x:0,y:0,h:0},this.comp.addSprite(a.def,a.state,c.x||0,c.y||0,c.h||0,
a.spriteOpts).particleData={xspeed:e(-400,400)/1E3,hspeed:e(-600,50)/1E3,xaccell:0,haccell:0.001,startx:c.x||0,starth:c.h||0,epoch:this.epoch}}var f,e=c.rnd,h=function(a,b){var c=a.particleData,d=b-c.epoch,e=d*d;a.x=Math.floor(c.startx+(c.xspeed*d+c.xaccell*e/2));a.h=Math.floor(c.starth-(c.hspeed*d+c.haccell*e/2));0>a.h&&(a.h=0)};b.prototype.update=function(a){this.comp.update(a,h.bind(this));if(void 0!==this.duration&&a-this.epoch>this.duration)return void 0!==this.endCallback&&this.endCallback(),
!1;a=this.comp.isActive();!a&&void 0!==this.endCallback&&this.endCallback();return a};return function(a){f=a;f.registerFxPlugin("particles",b)}});
@@ -73,18 +73,18 @@ define("plugins/ai/phasers/time-phaser",[],function(){function a(a,b){this.id=a;
function(a){void 0===a.phaserData&&(a.phaserData={});a.phaserData[this.id]={lastUpdate:0};this.sprites.push(a)};a.prototype.removeSprite=function(a){delete a.phaserData[this.id]};a.prototype.rebalance=function(a){var b=Math.min(this.frameCap,a-this.lastUpdate);this.lastUpdate=a;var d=Math.floor(b*this.updatesPerSecond/1E3),e=this.id,h=this.sprites;h.sort(function(a,b){return b.phaserData[e].lastUpdate-a.phaserData[e].lastUpdate});var g=0;for(a=h.length-1;0<=a;a--)b=h[a],b.phaserData.hasOwnProperty(this.id)?
b.phaserData[this.id].phaseOn=0<d--:g++;if(0<g){h=[];d=this.sprites.length;for(a=0;a<d;a++)b=h[a],b.phaserData.hasOwnProperty(this.id)&&h.push(b);this.sprites=h}};return function(c){d=c;d.registerPhaserPlugin("time-phaser",a)}});
define("plugins/ai/phasers/frame-phaser",[],function(){function a(a,b){this.id=a;b=b||{};if(void 0===b.phases||2>b.phases)throw"Frame phasers must have at least 2 phases.";this.phases=b.phases;this.buckets=Array(b.phases);this.bucketMax=Array(b.phases);this.sprites=[]}var d;a.prototype.phase=function(a,b){return 0===a.phaserData[this.id].phase};a.prototype.addSprite=function(a){void 0===a.phaserData&&(a.phaserData={});a.phaserData[this.id]={phase:this.phases-1};this.sprites.push(a)};a.prototype.removeSprite=
-function(a){delete a.phaserData[this.id]};a.prototype.rebalance=function(a){var b,d,e=0,h=this.buckets,g=this.sprites,l=g.length/this.phases;for(a=h.length-1;0<=a;a--)h[a]=0,this.bucketMax[a]=Math.floor((a+1)*l-Math.floor(a*l));var n=[],m=0;for(a=g.length-1;0<=a;a--)b=g[a],b.phaserData.hasOwnProperty(this.id)?(d=b.phaserData[this.id],d.phase++,d.phase>=this.phases&&(d.phase=0),e=Math.max(e,++h[d.phase]),h[d.phase]>this.bucketMax[d.phase]&&n.push(b)):m++;if(1<l&&0.8>l/e){g=0;for(a=n.length-1;0<=a;a--){for(b=
-n[a];h[g]>=this.bucketMax[g];)g++,g===this.phases&&(g=0);d=b.phaserData[this.id];h[d.phase]--;d.phase=g;h[g]++}}if(0<m){g=[];d=this.sprites.length;for(a=0;a<d;a++)b.phaserData.hasOwnProperty(this.id)&&g.push(this.sprites[a]);this.sprites=g}};return function(c){d=c;d.registerPhaserPlugin("frame-phaser",a)}});
+function(a){delete a.phaserData[this.id]};a.prototype.rebalance=function(a){var b,d,e=0,h=this.buckets,g=this.sprites,l=g.length/this.phases;for(a=h.length-1;0<=a;a--)h[a]=0,this.bucketMax[a]=Math.floor((a+1)*l-Math.floor(a*l));var p=[],m=0;for(a=g.length-1;0<=a;a--)b=g[a],b.phaserData.hasOwnProperty(this.id)?(d=b.phaserData[this.id],d.phase++,d.phase>=this.phases&&(d.phase=0),e=Math.max(e,++h[d.phase]),h[d.phase]>this.bucketMax[d.phase]&&p.push(b)):m++;if(1<l&&0.8>l/e){g=0;for(a=p.length-1;0<=a;a--){for(b=
+p[a];h[g]>=this.bucketMax[g];)g++,g===this.phases&&(g=0);d=b.phaserData[this.id];h[d.phase]--;d.phase=g;h[g]++}}if(0<m){g=[];d=this.sprites.length;for(a=0;a<d;a++)b.phaserData.hasOwnProperty(this.id)&&g.push(this.sprites[a]);this.sprites=g}};return function(c){d=c;d.registerPhaserPlugin("frame-phaser",a)}});
define("plugins/camera/push-cam",[],function(){function a(a){this.follow=d.sprite(a.follow);if(!this.follow)throw"Camera can't follow missing sprite: "+a.follow;}var d;a.prototype.update=function(a){d.scrollTo(this.follow.x-d.clientWidth/2,this.follow.y-d.clientHeight/2)};return function(c){d=c;d.registerCameraPlugin("pushcam",a)}});
-define("plugins/collision/lib/prop-scanner",[],function(){return function(a,d,c,b,f,e,h,g,l,n){var m=b,q=f,p=e,t=h,r,s=b+e|0,y=f+h|0;b|=0;f|=0;e=Math.abs(s-b);h=Math.abs(y-f);var B=0;void 0!==n&&(n.length=0,n.length=2*(Math.max(e,h)+1));if(0===e&&0===h)return l[0]=b,l[1]=f,1;var w=b<s?1:-1,u=f<y?1:-1,v=e-h,z=!1,A=b,x=f;void 0!==n&&(n[B++]=b,n[B++]=f);r=2*v;r>-h&&(v-=h,b+=w);r<e&&(v+=e,f+=u);for(;;){if(b<c.le||b>c.re||f<c.te||f>c.be){z=!0;break}r=a.getTilePropsAtWorldPos(d,b,f);if(r>g){z=!0;break}A=
-b;x=f;void 0!==n&&(n[B++]=b,n[B++]=f);if(b===s&&f===y)break;r=2*v;r>-h&&(v-=h,b+=w);r<e&&(v+=e,f+=u)}z?void 0!==l&&(l[0]=A,l[1]=x):void 0!==l&&(l[0]=m+p,l[1]=q+t);void 0!==n&&(n.length=B);return!z?1:e>h?(l[0]-m)/p:(l[1]-q)/t}});
+define("plugins/collision/lib/prop-scanner",[],function(){return function(a,d,c,b,f,e,h,g,l,p){var m=b,q=f,n=e,t=h,r,s=b+e|0,y=f+h|0;b|=0;f|=0;e=Math.abs(s-b);h=Math.abs(y-f);var B=0;void 0!==p&&(p.length=0,p.length=2*(Math.max(e,h)+1));if(0===e&&0===h)return l[0]=b,l[1]=f,1;var w=b<s?1:-1,u=f<y?1:-1,v=e-h,z=!1,A=b,x=f;void 0!==p&&(p[B++]=b,p[B++]=f);r=2*v;r>-h&&(v-=h,b+=w);r<e&&(v+=e,f+=u);for(;;){if(b<c.le||b>c.re||f<c.te||f>c.be){z=!0;break}r=a.getTilePropsAtWorldPos(d,b,f);if(r>g){z=!0;break}A=
+b;x=f;void 0!==p&&(p[B++]=b,p[B++]=f);if(b===s&&f===y)break;r=2*v;r>-h&&(v-=h,b+=w);r<e&&(v+=e,f+=u)}z?void 0!==l&&(l[0]=A,l[1]=x):void 0!==l&&(l[0]=m+n,l[1]=q+t);void 0!==p&&(p.length=B);return!z?1:e>h?(l[0]-m)/n:(l[1]-q)/t}});
define("plugins/collision/lib/local-scanner",[],function(){return{ySlip:function(a,d,c,b,f,e){f/=e;if(2<=f&&3>=f){if(a.getTilePropsAtWorldPos("height",d+1,c-1)>b&&a.getTilePropsAtWorldPos("height",d,c-1)>b&&a.getTilePropsAtWorldPos("height",d+1,c)>b)return 1;if(a.getTilePropsAtWorldPos("height",d-1,c+1)>b&&a.getTilePropsAtWorldPos("height",d-1,c)>b&&a.getTilePropsAtWorldPos("height",d,c+1)>b)return-1}else if(-2>=f&&-3<=f){if(a.getTilePropsAtWorldPos("height",d+1,c+1)>b&&a.getTilePropsAtWorldPos("height",
d,c+1)>b&&a.getTilePropsAtWorldPos("height",d+1,c)>b)return-1;if(a.getTilePropsAtWorldPos("height",d-1,c-1)>b&&a.getTilePropsAtWorldPos("height",d-1,c)>b&&a.getTilePropsAtWorldPos("height",d,c-1)>b)return 1}return 0}}});
-define("plugins/collision/sprite-with-map/line-trace",["plugins/collision/lib/prop-scanner","plugins/collision/lib/local-scanner"],function(a,d){function c(a){a=a||{};this.sn=b;this.edges=b.getWorldEdges();this.xy=[0,0];this.autoSlip=void 0===a.autoSlip?!0:a.autoSlip}var b,f=d.ySlip;c.prototype.test=function(c,d,g,l,n,m){var q=b.worldToTilePos(c,d,this.xy);if(g*g+l*l<=q*q)return m[0]=c+g,m[1]=d+l,1;this.autoSlip&&(d+=f(b,c,d,n,g,l));return a(b,"height",this.edges,c,d,g,l,n,m)};return function(a){b=
-a;b.registerColliderPlugin("line-trace",c)}});define("plugins/collision/lib/ellipse",[],function(){return function(a,d){var c=a*a,b=d*d,f=2*c,e=2*b,h,g=0,l=d,n=0,m=f*l,q=[];q.push(g,l,-g,l,g,-l,-g,-l);for(h=Math.round(b-c*d+0.25*c);n<m;)g++,n+=e,0>h?h+=b+n:(l--,m-=f,h+=b+n-m),q.push(g,l,-g,l,g,-l,-g,-l);for(h=Math.round(b*(g+0.5)*(g+0.5)+c*(l-1)*(l-1)-c*b);0<l;)l--,m-=f,0<h?h+=c-m:(g++,n+=e,h+=c-m+n),q.push(g,l,-g,l,g,-l,-g,-l);return q}});
+define("plugins/collision/sprite-with-map/line-trace",["plugins/collision/lib/prop-scanner","plugins/collision/lib/local-scanner"],function(a,d){function c(a){a=a||{};this.sn=b;this.edges=b.getWorldEdges();this.xy=[0,0];this.autoSlip=void 0===a.autoSlip?!0:a.autoSlip}var b,f=d.ySlip;c.prototype.test=function(c,d,g,l,p,m){var q=b.worldToTilePos(c,d,this.xy);if(g*g+l*l<=q*q)return m[0]=c+g,m[1]=d+l,1;this.autoSlip&&(d+=f(b,c,d,p,g,l));return a(b,"height",this.edges,c,d,g,l,p,m)};return function(a){b=
+a;b.registerColliderPlugin("line-trace",c)}});define("plugins/collision/lib/ellipse",[],function(){return function(a,d){var c=a*a,b=d*d,f=2*c,e=2*b,h,g=0,l=d,p=0,m=f*l,q=[];q.push(g,l,-g,l,g,-l,-g,-l);for(h=Math.round(b-c*d+0.25*c);p<m;)g++,p+=e,0>h?h+=b+p:(l--,m-=f,h+=b+p-m),q.push(g,l,-g,l,g,-l,-g,-l);for(h=Math.round(b*(g+0.5)*(g+0.5)+c*(l-1)*(l-1)-c*b);0<l;)l--,m-=f,0<h?h+=c-m:(g++,p+=e,h+=c-m+p),q.push(g,l,-g,l,g,-l,-g,-l);return q}});
define("plugins/collision/sprite-with-map/circle-trace",["plugins/collision/lib/prop-scanner","plugins/collision/lib/ellipse","plugins/collision/lib/local-scanner"],function(a,d,c){function b(a){a=a||{};this.sn=f;if(void 0===a.radius||0===a.radius)throw"Circle trace requires a radius >0 in its options.";this.radius=a.radius;this.edges=f.getWorldEdges();this.samples=d(a.radius|0,a.radius/2|0);this.lineHit=[0,0];this.autoSlip=void 0===a.autoSlip?!0:a.autoSlip}var f,e=c.ySlip;b.prototype.isPointSolid=
-function(a,b,c){for(var d=this.samples.length-2;0<=d;d-=2)if(f.getTilePropsAtWorldPos("height",a+this.samples[d],b+this.samples[d+1])>c)return!0;return!1};b.prototype.test=function(b,c,d,n,m,q){var p,t,r;r=f.worldToTilePos(b,c,this.lineHit);p=Math.abs(d)+this.radius;t=Math.abs(n/2)+this.radius/2;if(p*p+t*t<=r*r)return q[0]=b+d,q[1]=c+n,1;if(this.autoSlip){var s=0;for(r=this.samples.length-2;0<=r;r-=2)if(p=this.samples[r],t=this.samples[r+1],p=e(f,b+p,c+t,m,d,n),0===s)s=p;else if(0!==p&&s!==p){s=0;
-break}c+=s}var s=[],y=a(f,"height",this.edges,b,c,d,n,m,this.lineHit,s),B,w,u=!0;for(r=s.length-2;2<=r&&u;r-=2){for(var u=!1,v=this.samples.length-2;0<=v;v-=2)if(p=this.samples[v],t=this.samples[v+1],B=s[r],w=s[r+1],f.getTilePropsAtWorldPos("height",B+p,w+t)>m){u=!0;break}if(!u){if(r===s.length-2)return q[0]=this.lineHit[0],q[1]=this.lineHit[1],y;q[0]=B;q[1]=w;return d>n?(B-b)/d:(w-c)/n}}if(2===s.length&&1===y)return q[0]=b+d,q[1]=c+n,1;q[0]=b;q[1]=c;return 0};return function(a){f=a;f.registerColliderPlugin("circle-trace",
+function(a,b,c){for(var d=this.samples.length-2;0<=d;d-=2)if(f.getTilePropsAtWorldPos("height",a+this.samples[d],b+this.samples[d+1])>c)return!0;return!1};b.prototype.test=function(b,c,d,p,m,q){var n,t,r;r=f.worldToTilePos(b,c,this.lineHit);n=Math.abs(d)+this.radius;t=Math.abs(p/2)+this.radius/2;if(n*n+t*t<=r*r)return q[0]=b+d,q[1]=c+p,1;if(this.autoSlip){var s=0;for(r=this.samples.length-2;0<=r;r-=2)if(n=this.samples[r],t=this.samples[r+1],n=e(f,b+n,c+t,m,d,p),0===s)s=n;else if(0!==n&&s!==n){s=0;
+break}c+=s}var s=[],y=a(f,"height",this.edges,b,c,d,p,m,this.lineHit,s),B,w,u=!0;for(r=s.length-2;2<=r&&u;r-=2){for(var u=!1,v=this.samples.length-2;0<=v;v-=2)if(n=this.samples[v],t=this.samples[v+1],B=s[r],w=s[r+1],f.getTilePropsAtWorldPos("height",B+n,w+t)>m){u=!0;break}if(!u){if(r===s.length-2)return q[0]=this.lineHit[0],q[1]=this.lineHit[1],y;q[0]=B;q[1]=w;return d>p?(B-b)/d:(w-c)/p}}if(2===s.length&&1===y)return q[0]=b+d,q[1]=c+p,1;q[0]=b;q[1]=c;return 0};return function(a){f=a;f.registerColliderPlugin("circle-trace",
b)}});
define("plugins/default-plugins","plugins/sprite/bounce plugins/sprite/follow-mouse plugins/sprite/animate plugins/sprite/8way plugins/sprite/track plugins/sprite/flock plugins/sprite/apply-velocity plugins/layer/ui plugins/layer/ground-sprites plugins/fx/particles plugins/ai/phasers/time-phaser plugins/ai/phasers/frame-phaser plugins/camera/push-cam plugins/collision/sprite-with-map/line-trace plugins/collision/sprite-with-map/circle-trace".split(" "),function(){var a=arguments;return function(d){for(var c=0;c<
a.length;c++)a[c](d)}});
@@ -97,15 +97,15 @@ b=(a/=b)*a;return d+c*(4*b*a+-3*b)},backInQuartic:function(a,d,c,b){a=Math.min(b
-59*b*b+32*a+-5*b)}}});
define("ai/proximity-tracker",[],function(){function a(a,c){if(2>c||0!==(c&1)||c!==c|0)throw"Cell size must be an even integer > 0";this.cellw=c;this.cellh=c/2;this.sn=a;var d=a.getWorldEdges();this.le=d.le;this.re=d.re;this.te=d.te;this.be=d.be;var d=this.be-this.te,h=this.re-this.le;this.span=h;d=Math.ceil(d/this.cellh);h=Math.ceil(h/this.cellw);this.cells=Array(d*h);this.id=a.util.uid();this.candidateCache={}}var d=function(a){var c=a.proximityData[this.id];void 0!==c.cell&&(c=this.cells[c.cell],
a=c.sprites.indexOf(a),0<=a&&c.sprites.splice(a,1))},c=function(a){a=Math.ceil(a/this.cellw);if(this.candidateCache.hasOwnProperty(a))a=this.candidateCache[a],this.certains=a.certains,this.uncertains=a.uncertains;else{if(1===a){this.certains=[];var c=this.span;this.uncertains=[-c-1,-c,-c+1,-1,0,1,c-1,c,c+1]}else{this.certains=[];this.uncertains=[];for(c=-a-1;c<=a+1;c++)for(var d=-a-1;d<=a+1;d++){var h=c+(0<c?1:-1),g=d+(0<d?1:-1);h*h+g*g<a*a?this.certains.push(d*this.span+c):(h=c-(0<c?1:-1),g=d-(0<
-d?1:-1),h*h+g*g<a*a&&this.uncertains.push(d*this.span+c))}}this.candidateCache[a]={certains:this.certains,uncertains:this.uncertains}}};a.prototype.find=function(a,d,e,h){c.call(this,e);var g,l,n,m,q,p,t=[],r=(d/this.cellh|0)*this.span+(a/this.cellw|0);for(g=this.certains.length-1;0<=g;g--)if(l=r+this.certains[g],0<=l&&l<this.cells.length&&(n=this.cells[l],void 0!==n)){if(!0===h)for(l=n.sprites.length-1;0<=l;l--)m=n.sprites[l],q=a-m.x,p=2*(d-m.y),m.tmpDist2=q*q+p*p;t=t.concat(n.sprites)}e*=e;for(g=
-this.uncertains.length-1;0<=g;g--)if(l=r+this.uncertains[g],0<=l&&l<this.cells.length&&(n=this.cells[l],void 0!==n))for(l=n.sprites.length-1;0<=l;l--)m=n.sprites[l],q=a-m.x,p=2*(d-m.y),m.tmpDist2=q*q+p*p,m.tmpDist2<=e&&t.push(m);!0===h&&t.sort(function(a,b){return a.tmpDist2-b.tmpDist2});return t};a.prototype.track=function(a){var c=a.proximityData[this.id],e=(a.y/this.cellh|0)*this.span+(a.x/this.cellw|0);e!==c.cell&&(d.call(this,a),void 0===this.cells[e]?this.cells[e]={sprites:[a]}:this.cells[e].sprites.push(a),
+d?1:-1),h*h+g*g<a*a&&this.uncertains.push(d*this.span+c))}}this.candidateCache[a]={certains:this.certains,uncertains:this.uncertains}}};a.prototype.find=function(a,d,e,h){c.call(this,e);var g,l,p,m,q,n,t=[],r=(d/this.cellh|0)*this.span+(a/this.cellw|0);for(g=this.certains.length-1;0<=g;g--)if(l=r+this.certains[g],0<=l&&l<this.cells.length&&(p=this.cells[l],void 0!==p)){if(!0===h)for(l=p.sprites.length-1;0<=l;l--)m=p.sprites[l],q=a-m.x,n=2*(d-m.y),m.tmpDist2=q*q+n*n;t=t.concat(p.sprites)}e*=e;for(g=
+this.uncertains.length-1;0<=g;g--)if(l=r+this.uncertains[g],0<=l&&l<this.cells.length&&(p=this.cells[l],void 0!==p))for(l=p.sprites.length-1;0<=l;l--)m=p.sprites[l],q=a-m.x,n=2*(d-m.y),m.tmpDist2=q*q+n*n,m.tmpDist2<=e&&t.push(m);!0===h&&t.sort(function(a,b){return a.tmpDist2-b.tmpDist2});return t};a.prototype.track=function(a){var c=a.proximityData[this.id],e=(a.y/this.cellh|0)*this.span+(a.x/this.cellw|0);e!==c.cell&&(d.call(this,a),void 0===this.cells[e]?this.cells[e]={sprites:[a]}:this.cells[e].sprites.push(a),
c.cell=e)};a.prototype.register=function(a){var c=(a.y/this.cellh|0)*this.span+(a.x/this.cellw|0);void 0===this.cells[c]?this.cells[c]={sprites:[a]}:this.cells[c].sprites.push(a);a.proximityData={};a.proximityData[this.id]={cell:c};this.track(a)};a.prototype.unregister=function(a){d.call(this,a);delete a.proximityData[this.id]};return a});
define("ai/pathfinder",["util/clock"],function(a){function d(a,b){this.x=a;this.y=b;this.priority=0}function c(a,b,c,e,f){this.sn=a;var g=a.map;this.ground=g.groundLayer();this.xcount=g.data.width;this.ycount=g.data.height;this.nodeRows=Array(this.ycount);void 0===e&&(e=!0);void 0===c&&(c=!0);for(var h=this.nodeRows.length-1;0<=h;h--)this.nodeRows[h]=Array(this.xcount);b=b||function(b,c){return 0<a.getTilePropsAtTilePos("height",b,c)};h=Math.sqrt(2);this.cost=f||function(a,b){return 1};if(g.isStaggered())this.xdirectionsOdd=
c?[1,1,0,0,-1,0,0,1]:[1,0,-1,0],this.ydirectionsOdd=c?[0,1,2,1,0,-1,-2,-1]:[0,2,0,-2],this.xdirectionsEven=c?[1,0,0,-1,-1,-1,0,0]:[1,0,-1,0],this.ydirectionsEven=c?[0,1,2,1,0,-1,-2,-1]:[0,2,0,-2],this.distances=c?[h,1,h,1,h,1,h,1]:[1,1,1,-1],this.distance=e?function(a){return this.distances[a]}:function(a,c,d){var e=0===(d&1),f=e?this.xdirectionsEven:this.xdirectionsOdd,e=e?this.ydirectionsEven:this.ydirectionsOdd;switch(a){case 0:return b(c+f[7],d+e[7])||b(c+f[1],d+e[1])?3:this.distances[a];case 2:return b(c+
f[3],d+e[3])||b(c+f[1],d+e[1])?3:this.distances[a];case 4:return b(c+f[3],d+e[3])||b(c+f[5],d+e[5])?3:this.distances[a];case 6:return b(c+f[7],d+e[7])||b(c+f[5],d+e[5])?3:this.distances[a];default:return this.distances[a]}},this.ndirections=this.xdirectionsOdd.length;else if(g.isOrthogonal()){this.xdirectionsOdd=c?[1,1,0,-1,-1,-1,0,1]:[1,0,-1,0];this.ydirectionsOdd=c?[0,1,1,1,0,-1,-1,-1]:[0,1,0,-1];this.xdirectionsEven=this.xdirectionsOdd;this.ydirectionsEven=this.ydirectionsOdd;this.distances=c?
[1,h,1,h,1,h,1,h]:[1,1,1,-1];if(e)this.distance=function(a){return this.distances[a]};else throw"Unsupported cutcorners===false in map of type: "+g.type;this.ndirections=this.xdirectionsOdd.length}else throw"Unsupported map orientation in PathFinder: "+g.type;this.scoreHeap=new a.MinHeap;this.node=function(a,c){if(0>a||(a>=this.xcount||0>c||c>=this.ycount)||b(a,c))return null;var e;0===this.nodeRows[c].length&&(this.nodeRows[c].length=this.xcount);if(void 0===this.nodeRows[c][a])e=new d(a,c),this.nodeRows[c][a]=
-e;else return this.nodeRows[c][a];return e};this.reconstructPath=function(a){for(var b=[];a.cameFrom;)b.push(a.x,a.y),a=a.cameFrom;b.push(this.x0,this.y0);return b}}var b=[0,1,1,1,0,0,-1,0],f=[-2,-1,0,1,2,1,0,-1],e=[0,0,1,0,0,-1,-1,-1],h=[-2,-1,0,1,2,1,0,-1],g=function(a,c,d,g,p){if(2>=a.length)return[];var t=this.sn.map,r=Array(d*(a.length/2-1)),s=[],y,B,w,u,v=-1;if((g=!!g)&&p){if(0!==p.length)throw"wideroute output array length must be 0";p.push.apply(p,a)}var z=function(a,g,l){var q,r,t,z,u,F;
-if(-1!==v){q=0===(l&1);switch(v){case 0:q?(q=e[5],r=h[5],t=e[3],z=h[3]):(q=b[5],r=f[5],t=b[3],z=f[3]);break;case 2:q?(q=e[7],r=h[7],t=e[5],z=h[5]):(q=b[7],r=f[7],t=b[5],z=f[5]);break;case 4:q?(q=e[1],r=h[1],t=e[7],z=h[7]):(q=b[1],r=f[1],t=b[7],z=f[7]);break;case 6:q?(q=e[3],r=h[3],t=e[1],z=h[1]):(q=b[3],r=f[3],t=b[1],z=f[1]);break;default:v=a;return}p&&(p.push(g+q,l+r),p.push(g+t,l+z));if(v===a)s.push.apply(s,c.slice(a*d,(a+1)*d)),s.push.apply(s,c.slice(a*d,(a+1)*d));else{switch(v){case 0:u=1;F=7;
+e;else return this.nodeRows[c][a];return e};this.reconstructPath=function(a){for(var b=[];a.cameFrom;)b.push(a.x,a.y),a=a.cameFrom;b.push(this.x0,this.y0);return b}}var b=[0,1,1,1,0,0,-1,0],f=[-2,-1,0,1,2,1,0,-1],e=[0,0,1,0,0,-1,-1,-1],h=[-2,-1,0,1,2,1,0,-1],g=function(a,c,d,g,n){if(2>=a.length)return[];var t=this.sn.map,r=Array(d*(a.length/2-1)),s=[],y,B,w,u,v=-1;if((g=!!g)&&n){if(0!==n.length)throw"wideroute output array length must be 0";n.push.apply(n,a)}var z=function(a,g,l){var q,r,t,z,u,F;
+if(-1!==v){q=0===(l&1);switch(v){case 0:q?(q=e[5],r=h[5],t=e[3],z=h[3]):(q=b[5],r=f[5],t=b[3],z=f[3]);break;case 2:q?(q=e[7],r=h[7],t=e[5],z=h[5]):(q=b[7],r=f[7],t=b[5],z=f[5]);break;case 4:q?(q=e[1],r=h[1],t=e[7],z=h[7]):(q=b[1],r=f[1],t=b[7],z=f[7]);break;case 6:q?(q=e[3],r=h[3],t=e[1],z=h[1]):(q=b[3],r=f[3],t=b[1],z=f[1]);break;default:v=a;return}n&&(n.push(g+q,l+r),n.push(g+t,l+z));if(v===a)s.push.apply(s,c.slice(a*d,(a+1)*d)),s.push.apply(s,c.slice(a*d,(a+1)*d));else{switch(v){case 0:u=1;F=7;
break;case 2:u=3;F=1;break;case 4:u=5;F=3;break;case 6:u=7,F=5}s.push.apply(s,c.slice(u*d,(u+1)*d));s.push.apply(s,c.slice(F*d,(F+1)*d))}}v=a};if(t.isStaggered()){for(u=a.length-4;0<=u;u-=2){y=a[u];B=a[u+1];t=a[u+2];w=a[u+3];var A=y-t,x=[d*u/2,d];switch(B-w){case -2:A=0;break;case -1:A=0===A!==(0!==(B&1))?7:1;break;case 0:A=1===A?2:6;break;case 1:A=0===A!==(0!==(B&1))?5:3;break;default:A=4}g&&z(A,t,w);r.splice.apply(r,x.concat(c.slice(A*d,(A+1)*d)))}g&&z(-1,y,B)}else throw"Unsupported map orientation in routeToDirections/routeToVectors: "+
t.type;0<s.length&&r.push.apply(r,s);return r};c.prototype.routeToVectors=function(a,b,c){return g.call(this,a,[0,-1,1,-1,1,0,1,1,0,1,-1,1,-1,0,-1,-1],2,b,c)};c.prototype.routeToDirections=function(a,b,c){return g.call(this,a,"n ne e se s sw w nw".split(" "),1,b,c)};c.prototype.route=function(a,b,c,d){this.taskBegin({x0:a,y0:b,x1:c,y1:d});return this.taskResume(0)};c.prototype.taskBegin=function(a){this.x0=a.x0;this.y0=a.y0;this.x1=a.x1;this.y1=a.y1;for(a=this.nodeRows.length-1;0<=a;a--)this.nodeRows[a].length=
0;a=this.node(this.x0,this.y0);if(null===a)return[];a.open=!0;this.scoreHeap.clear().push(a);var b=this.x1-this.x0,c=this.y1-this.y0;a.fscore=b*b+c*c};c.prototype.taskResume=function(b){for(var c=this.x1,d=this.y1,e;0<this.scoreHeap.size();){var f=this.scoreHeap.peek();if(f.x===c&&f.y===d)return this.reconstructPath(f);this.scoreHeap.pop();f.closed=!0;for(e=this.ndirections-1;0<=e;e--){var g=0===(f.y&1),g=this.node(f.x+(g?this.xdirectionsEven[e]:this.xdirectionsOdd[e]),f.y+(g?this.ydirectionsEven[e]:
@@ -113,15 +113,15 @@ this.ydirectionsOdd[e]));if(null!==g){var h=f.priority+this.cost(f.x,f.y)*this.d
define("polyfills/requestAnimationFrame",["util/clock"],function(a){for(var d=function(){window.requestAnimationFrame=function(c,d){var e=a.now(),f=Math.max(0,16-(e-b)),m=window.setTimeout(function(){c(e+f)},f);b=e+f;return m}},c=function(){window.cancelAnimationFrame=function(a){clearTimeout(a)}},b=0,f=["ms","moz","webkit","o"],e=0;e<f.length&&!window.requestAnimationFrame;++e)window.requestAnimationFrame=window[f[e]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[f[e]+"CancelAnimationFrame"]||
window[f[e]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||d();window.cancelAnimationFrame||c();return function(){a.fixedOutput();d();c()}});
define("polyfills/bind",[],function(){Function.prototype.bind||(Function.prototype.bind=function(a){if("function"!==typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var d=Array.prototype.slice.call(arguments,1),c=this,b=function(){},f=function(){return c.apply(this instanceof b&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))};b.prototype=this.prototype;f.prototype=new b;return f})});
-define("snaps","sprites/spritedef sprites/sprite sprites/composite util/all map/staggered-isometric input/all plugins/default-plugins tasks/slowqueue animate/tween ai/proximity-tracker ai/pathfinder polyfills/requestAnimationFrame polyfills/bind".split(" "),function(a,d,c,b,f,e,h,g,l,n,m,q){function p(p,A,x){function D(a){315532800<a&&0===k.epoch&&(k.epoch=a-16);a-=k.epoch;k.now=a;k.requestAnimationFrame(D);k.updateTasks();k.updateFX();k.map.updateLayers(a);k.updatePhasers();I(a-k.lastFrameTime);
+define("snaps","sprites/spritedef sprites/sprite sprites/composite util/all map/staggered-isometric input/all plugins/default-plugins tasks/slowqueue animate/tween ai/proximity-tracker ai/pathfinder polyfills/requestAnimationFrame polyfills/bind".split(" "),function(a,d,c,b,f,e,h,g,l,p,m,q){function n(n,A,x){function D(a){315532800<a&&0===k.epoch&&(k.epoch=a-16);a-=k.epoch;k.now=a;k.requestAnimationFrame(D);k.updateTasks();k.updateFX();k.map.updateLayers(a);k.updatePhasers();I(a-k.lastFrameTime);
k.updateSprites();k.camera&&k.camera.update(a);G(k.ctx);k.dbgShowRegions&&void 0!==k.map&&k.map.drawDebugRegions(k.ctx,k.dbgRegionProps);0<k.activeUIPanels.length&&k.drawUIPanels();k.dbgShowMouse&&(t(k.ctx,"Screen: "+k.mouse.x+","+k.mouse.y,5,15),t(k.ctx,"World: "+(k.mouse.x+k.map.xoffset)+","+(k.mouse.y+k.map.yoffset),5,30),t(k.ctx,"Origin: "+k.map.xoffset+","+k.map.yoffset,5,45));k.dbgShowCounts&&t(k.ctx,"Sprites: "+k.spriteCount(),5,k.clientHeight-15);if(k.dbgShowMouseTile&&void 0!==k.map){a=[0,
-0];k.mouseWorldPos(a);var b=[0,0];k.worldToTilePos(a[0],a[1],b);t(k.ctx,"Mouse in tile: "+b[0]+", "+b[1],5,k.clientHeight-30)}k.lastFrameTime=k.now}var k=this;this.requestAnimationFrame=window.requestAnimationFrame.bind(window);this.util=b;this.tweens=l;this.MinHeap=s;this.Stats=B;this.ProximityTracker=n.bind(n,this);this.Panel=e.Panel.bind(e.Panel,this);this.Label=e.Label.bind(e.Label,this);this.Button=e.Button.bind(e.Button,this);this.PathFinder=m.bind(m,this);x=x||{};this.dbgShowMouse=!!x.showMouse;
+0];k.mouseWorldPos(a);var b=[0,0];k.worldToTilePos(a[0],a[1],b);t(k.ctx,"Mouse in tile: "+b[0]+", "+b[1],5,k.clientHeight-30)}k.lastFrameTime=k.now}var k=this;this.requestAnimationFrame=window.requestAnimationFrame.bind(window);this.util=b;this.tweens=l;this.MinHeap=s;this.Stats=B;this.ProximityTracker=p.bind(p,this);this.Panel=e.Panel.bind(e.Panel,this);this.Label=e.Label.bind(e.Label,this);this.Button=e.Button.bind(e.Button,this);this.PathFinder=m.bind(m,this);x=x||{};this.dbgShowMouse=!!x.showMouse;
this.dbgShowCounts=!!x.showCounts;this.dbgShowMouseTile=!!x.showMouseTile;this.dbgShowRegions=!!x.showRegions;this.dbgRegionProps=x.showRegions&&0<x.showRegions.length&&"true"!==x.showRegions?x.showRegions.split(","):[];this.imageCache={};this.audioCache={};this.spriteUpdaters={};this.colliders={};this.fxUpdaters={};this.layerPlugins={};this.cameraPlugins={};this.phaserPlugins={};this.stats=new B;this.timers={};this.cameras={};this.camera=null;this.activeFX=[];this.taskQueues=[];this.activeUIPanels=
-[];this.epoch=this.now=0;var C=document.getElementById(A);this.clientWidth=C.clientWidth;this.clientHeight=C.clientHeight;this.ctx=C.getContext("2d");this.keyboard=new u;this.mouse=new v(C);this.ctx.fillStyle="#000022";this.ctx.fillRect(0,0,C.clientWidth,C.clientHeight);this.game=p;if(void 0!==p.map){if("object"!==typeof p.hitTests||void 0===p.hitTests.hit)throw"Game must define a hitTests object with at least a 'hit' property";this.map=new f(p.map,p.hitTests,this.clientWidth,this.clientHeight,this.stats);
+[];this.epoch=this.now=0;var C=document.getElementById(A);this.clientWidth=C.clientWidth;this.clientHeight=C.clientHeight;this.ctx=C.getContext("2d");this.keyboard=new u;this.mouse=new v(C);this.ctx.fillStyle="#000022";this.ctx.fillRect(0,0,C.clientWidth,C.clientHeight);this.game=n;if(void 0!==n.map){if("object"!==typeof n.hitTests||void 0===n.hitTests.hit)throw"Game must define a hitTests object with at least a 'hit' property";this.map=new f(n.map,n.hitTests,this.clientWidth,this.clientHeight,this.stats);
this.map.hideBuildings=!!x.hideBuildings}var G=k.game.draw,I=k.game.update;this.spriteDefs={};this.sprites=[];this.phasers=[];this.spriteMap={};this.lastFrameTime=0;this.registerSpriteUpdater=function(a,b){k.spriteUpdaters[a]=b};this.registerFxPlugin=function(a,b){k.fxUpdaters[a]=b};this.registerLayerPlugin=function(a,b){k.layerPlugins[a]=b};this.registerColliderPlugin=function(a,b){k.colliders[a]=b};this.registerCameraPlugin=function(a,b){k.cameraPlugins[a]=b};this.registerPhaserPlugin=function(a,
-b){k.phaserPlugins[a]=b};h(this);if("function"===typeof k.game.onEngineStart)k.game.onEngineStart(this);x=new r;void 0!==this.map&&this.map.primePreloader(x);var E;if("object"===typeof p.preloadImages)for(E in C=function(a,b){k.imageCache[b]=a},p.preloadImages)x.addImage(p.preloadImages[E],E,C);if("object"===typeof p.sounds){if("object"!==typeof p.audioChannels)throw"Game defines sounds, but is missing audioChannels";k.audioChannels={};for(var H in p.audioChannels){k.audioChannels[H]=[];for(C=p.audioChannels[H];0<
-C--;)k.audioChannels[H].push(null)}H=function(a,b){k.audioCache[b]=a};for(E in p.sounds)x.addAudio(p.sounds[E],E,H)}if("object"===typeof k.game.spriteDefs){p=function(b,c){var d,e=k.game.spriteDefs[c],f=new a(b,e.w,e.h,e.x,e.y);k.spriteDefs[c]=f;for(d in e.states)"object"===typeof e.states[d]&&f.addState(d,e.states[d].seq,e.states[d].dur),"number"===typeof e.states[d]&&f.addState(d,[e.states[d]],1E3);for(d in e.states)"string"===typeof e.states[d]&&f.aliasState(d,e.states[d])};for(var J in k.game.spriteDefs)x.addImage(k.game.spriteDefs[J].path,
-J,p)}this.drawImage=function(a,b,c){k.ctx.drawImage(k.imageCache[a],b,c)};this.cls=function(a){k.ctx.fillStyle=a||"#000";k.ctx.fillRect(0,0,k.clientWidth,k.clientHeight)};this.spriteStateExists=function(a,b){var c=k.spriteDefs.hasOwnProperty(a);return!c||void 0===b?c:k.spriteDefs[a].hasState(b)};this.activatePanel=function(a){for(var b=this.activeUIPanels.length-1;0<=b;b--)if(this.activeUIPanels[b].id===a.id)return;this.activeUIPanels.push(a)};this.deactivatePanel=function(a){for(var b=this.activeUIPanels.length-
+b){k.phaserPlugins[a]=b};h(this);if("function"===typeof k.game.onEngineStart)k.game.onEngineStart(this);x=new r;void 0!==this.map&&this.map.primePreloader(x);var E;if("object"===typeof n.preloadImages)for(E in C=function(a,b){k.imageCache[b]=a},n.preloadImages)x.addImage(n.preloadImages[E],E,C);if("object"===typeof n.sounds){if("object"!==typeof n.audioChannels)throw"Game defines sounds, but is missing audioChannels";k.audioChannels={};for(var H in n.audioChannels){k.audioChannels[H]=[];for(C=n.audioChannels[H];0<
+C--;)k.audioChannels[H].push(null)}H=function(a,b){k.audioCache[b]=a};for(E in n.sounds)x.addAudio(n.sounds[E],E,H)}if("object"===typeof k.game.spriteDefs){n=function(b,c){var d,e=k.game.spriteDefs[c],f=new a(b,e.w,e.h,e.x,e.y);k.spriteDefs[c]=f;for(d in e.states)"object"===typeof e.states[d]&&f.addState(d,e.states[d].seq,e.states[d].dur),"number"===typeof e.states[d]&&f.addState(d,[e.states[d]],1E3);for(d in e.states)"string"===typeof e.states[d]&&f.aliasState(d,e.states[d])};for(var J in k.game.spriteDefs)x.addImage(k.game.spriteDefs[J].path,
+J,n)}this.drawImage=function(a,b,c){k.ctx.drawImage(k.imageCache[a],b,c)};this.cls=function(a){k.ctx.fillStyle=a||"#000";k.ctx.fillRect(0,0,k.clientWidth,k.clientHeight)};this.spriteStateExists=function(a,b){var c=k.spriteDefs.hasOwnProperty(a);return!c||void 0===b?c:k.spriteDefs[a].hasState(b)};this.activatePanel=function(a){for(var b=this.activeUIPanels.length-1;0<=b;b--)if(this.activeUIPanels[b].id===a.id)return;this.activeUIPanels.push(a)};this.deactivatePanel=function(a){for(var b=this.activeUIPanels.length-
1;0<=b;b--)if(this.activeUIPanels[b].id===a.id){this.activeUIPanels.splice(b,1);break}};this.bindKeys=function(a){for(var b=0;b<a.length;b++){var c=a[b];k.keyboard.bind(c.key,c.action)}};this.updateTasks=function(){for(var a=w.now(),b=k.taskQueues.length-1;0<=b;b--)k.taskQueues[b].run();this.stats.count("updateTasks",w.now()-a)};this.updatePhasers=function(){for(var a=w.now(),b=k.phasers.length-1;0<=b;b--)k.phasers[b].rebalance(k.now);this.stats.count("updatePhasers",w.now()-a)};this.updateFX=function(){for(var a=
w.now(),b=k.activeFX.length-1;0<=b;b--)k.activeFX[b].update(k.now)||k.activeFX.splice(b,1);this.stats.count("updateFX",w.now()-a)};this.drawUIPanels=function(){for(var a=w.now(),b=0;b<this.activeUIPanels.length;b++)this.activeUIPanels[b].draw(this.now,k.ctx);this.stats.count("drawUIPanels",w.now()-a)};this.fx=function(a,b){if(!k.fxUpdaters.hasOwnProperty(a))throw"Can't create FX for unregistered FX type: "+a;k.activeFX.push(new k.fxUpdaters[a](b))};this.addLayer=function(a,b,c,d){c=c||{};if(!k.layerPlugins.hasOwnProperty(b))throw"Can't create layer for unregistered layer type: "+
b;a=new k.layerPlugins[b](a,c);k.map.insertLayer(d,a);return a};this.spriteCount=function(){for(var a=0,b=0;b<k.sprites.length;b++){var d=k.sprites[b];d instanceof c?a+=d.sprites.length:a++}return a};this.halt=function(){k.halt=!0};x.load(function(){void 0!==k.map&&k.map.resolveTiles();if("function"===typeof k.game.onResourcesLoaded)k.game.onResourcesLoaded();k.halt=!1;setTimeout(function(){D(0)},0)},function(a){if("function"===typeof k.game.onProgress)k.game.onProgress(a,k.ctx)},function(){"function"===
@@ -132,4 +132,4 @@ return a};this.createCamera=function(a,b,c){if(!k.cameraPlugins.hasOwnProperty(b
g,h);k.sprites.push(a);return k.spriteMap[h.id]=a};this.createComposite=function(a,b,d,e){if(void 0===d)d="id"+y();else if(k.spriteMap.hasOwnProperty(d))throw"Warning: duplicate sprite (composite) id "+d;a=new c(this,a,b,d,e);a.init();k.sprites.push(a);return k.spriteMap[d]=a};this.markTime=function(a,b){k.timers[a]=k.now+b};this.checkTimer=function(a,b){if(void 0===k.timers[a])return!1;var c=k.timers[a];if(0<k.now-c){if(void 0===b)delete k.timers[a];else{b=Math.max(1,b);do c+=b;while(c<k.now);k.timers[a]=
c}return!0}return!1};this.sprite=function(a){return k.spriteMap[a]};this.updateSprites=function(){var a=w.now(),b=[],c,d;for(c=k.sprites.length-1;0<=c;c--)d=k.sprites[c],d.isActive(k.now)?(d.update(k.now),b.push(d)):(d.onRemove(),delete k.spriteMap[d.name]);k.sprites=b;for(c=0;c<k.sprites.length;c++)d=k.sprites[c],d.commit(k.now);this.stats.count("updateSprites",w.now()-a)};this.getNow=function(){return k.now};this.playAudio=function(a,b){for(var c=function(b,c){if(null===b[c]){var d=k.audioCache[a];
b[c]=d;var e=function(a){b[c]=null;d.removeEventListener("ended",e)};d.addEventListener("ended",e);d.play();return!0}return!1},d=k.audioChannels[b],e=d.length-1;0<=e;e--)if(c(d,e))return!0;return!1};this.overrideClock=function(){q()};this.createPhaser=function(a,b){if(!k.phaserPlugins.hasOwnProperty(a))throw"Can't create phaser for unregistered type: "+a;var c=new k.phaserPlugins[a]("id"+y(),b);k.phasers.push(c);return c};this.resizeCanvas=function(){var a=document.getElementById(A);this.clientWidth=
-a.clientWidth;this.clientHeight=a.clientHeight;k.map.onResize(a.clientWidth,a.clientHeight)}}var t=b.debug.debugText,r=b.Preloader,s=b.MinHeap,y=b.uid,B=b.Stats,w=b.clock,u=e.Keyboard,v=e.Mouse;p.util=b;return p});
+a.clientWidth;this.clientHeight=a.clientHeight;k.map.onResize(a.clientWidth,a.clientHeight)}}var t=b.debug.debugText,r=b.Preloader,s=b.MinHeap,y=b.uid,B=b.Stats,w=b.clock,u=e.Keyboard,v=e.Mouse;n.util=b;return n});
View
2  package.json
@@ -14,7 +14,7 @@
"bugs": {
"url": "https://github.com/izb/snaps.js/issues"
},
- "version": "0.1.20",
+ "version": "0.1.21",
"jam": {
"dependencies": {
},
View
5 src/input/ui/panel.js
@@ -1,9 +1,10 @@
/*global define*/
define(['util/uid',
'input/ui/button',
+ 'input/ui/label',
'sprites/sprite'],
-function(uid, Button, Sprite) {
+function(uid, Button, Label, Sprite) {
/**
* @module input/ui/panel
@@ -176,6 +177,8 @@ function(uid, Button, Sprite) {
/* Sprites expect map offsets, which are the opposite of our screen offsets, so we
* negate them here. */
c.draw(ctx, -xo, -yo, now);
+ } else if (c instanceof Label) {
+ /* TODO */
} else {
/* TODO */
throw "Can't draw "+c;
Please sign in to comment.
Something went wrong with that request. Please try again.