diff --git a/bla/muri.zip b/bla/muri.zip new file mode 100644 index 0000000..8d6f0ba Binary files /dev/null and b/bla/muri.zip differ diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..18d860f --- /dev/null +++ b/build.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +rm -f muri-src.zip muri.zip +uglifyjs --no-dead-code --output src/muri.min.js src/*.js +(cd src && zip -q -9 ../muri.zip index.html muri.min.js assets/**/* vendor/*.min.js) +(cd src && zip -q -9 ../muri-src.zip *) + +filesize=`stat --printf="%s" muri.zip` +echo $filesize "byte ->" $((100*$filesize/13000)) "%" diff --git a/muri-src.zip b/muri-src.zip new file mode 100644 index 0000000..66c84a9 Binary files /dev/null and b/muri-src.zip differ diff --git a/muri.zip b/muri.zip new file mode 100644 index 0000000..05fdda3 Binary files /dev/null and b/muri.zip differ diff --git a/src/index.html b/src/index.html index cc0b2e3..a707228 100644 --- a/src/index.html +++ b/src/index.html @@ -1,15 +1 @@ - - -

murí

-

a js13kgame by Aaron Fischer (2017)

- -
-
- - -
-
-

loading game ...

- - - +

murí

a js13kgame by Aaron Fischer (2017)

loading game ...

diff --git a/src/index_dev.html b/src/index_dev.html new file mode 100644 index 0000000..cc0b2e3 --- /dev/null +++ b/src/index_dev.html @@ -0,0 +1,15 @@ + + +

murí

+

a js13kgame by Aaron Fischer (2017)

+ +
+
+ + +
+
+

loading game ...

+ + + diff --git a/src/muri.min.js b/src/muri.min.js new file mode 100644 index 0000000..220d17a --- /dev/null +++ b/src/muri.min.js @@ -0,0 +1 @@ +"use strict";var muri=function(){kontra.init("js13k-2017");kontra.assets.imagePath="assets/images";var muri={};var bg=function(room){return kontra.sprite({x:0,y:0,image:kontra.assets.images["room_"+room]})};muri.modules=[];muri.start=function(){kontra.assets.load("player.png","room_stasis_dark.png","room_stasis.png").then(function(){document.getElementById("loading").style.display="none";if(kontra.store.get("current-room")===null)kontra.store.set("current-room","stasis_dark");var rooms={stasis_dark:bg("stasis_dark"),stasis:bg("stasis")};kontra.gameLoop({update:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].update();for(m in muri.modules)m.update()},render:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].render();for(m in muri.modules)m.render()}}).start()})};return muri}();window.onload=muri.start;"use strict";var muri=function(){kontra.init("js13k-2017");kontra.assets.imagePath="assets/images";var muri={};var bg=function(room){return kontra.sprite({x:0,y:0,image:kontra.assets.images["room_"+room]})};muri.modules=[];muri.start=function(){kontra.assets.load("player.png","room_stasis_dark.png","room_stasis.png").then(function(){document.getElementById("loading").style.display="none";if(kontra.store.get("current-room")===null)kontra.store.set("current-room","stasis_dark");var rooms={stasis_dark:bg("stasis_dark"),stasis:bg("stasis")};kontra.gameLoop({update:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].update();for(m in muri.modules)m.update()},render:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].render();for(m in muri.modules)m.render()}}).start()})};return muri}();window.onload=muri.start;"use strict";var muri=function(){kontra.init("js13k-2017");kontra.assets.imagePath="assets/images";var muri={};var bg=function(room){return kontra.sprite({x:0,y:0,image:kontra.assets.images["room_"+room]})};muri.modules=[];muri.start=function(){kontra.assets.load("player.png","room_stasis_dark.png","room_stasis.png").then(function(){document.getElementById("loading").style.display="none";if(kontra.store.get("current-room")===null)kontra.store.set("current-room","stasis_dark");var rooms={stasis_dark:bg("stasis_dark"),stasis:bg("stasis")};kontra.gameLoop({update:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].update();for(m in muri.modules)m.update()},render:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].render();for(m in muri.modules)m.render()}}).start()})};return muri}();window.onload=muri.start;"use strict";var muri=function(){kontra.init("js13k-2017");kontra.assets.imagePath="assets/images";var muri={};var bg=function(room){return kontra.sprite({x:0,y:0,image:kontra.assets.images["room_"+room]})};muri.modules=[];muri.start=function(){kontra.assets.load("player.png","room_stasis_dark.png","room_stasis.png").then(function(){document.getElementById("loading").style.display="none";if(kontra.store.get("current-room")===null)kontra.store.set("current-room","stasis_dark");var rooms={stasis_dark:bg("stasis_dark"),stasis:bg("stasis")};kontra.gameLoop({update:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].update();for(m in muri.modules)m.update()},render:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].render();for(m in muri.modules)m.render()}}).start()})};return muri}();window.onload=muri.start;"use strict";var muri=function(){kontra.init("js13k-2017");kontra.assets.imagePath="assets/images";var muri={};var bg=function(room){return kontra.sprite({x:0,y:0,image:kontra.assets.images["room_"+room]})};muri.modules=[];muri.start=function(){kontra.assets.load("player.png","room_stasis_dark.png","room_stasis.png").then(function(){document.getElementById("loading").style.display="none";if(kontra.store.get("current-room")===null)kontra.store.set("current-room","stasis_dark");var rooms={stasis_dark:bg("stasis_dark"),stasis:bg("stasis")};kontra.gameLoop({update:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].update();for(m in muri.modules)m.update()},render:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].render();for(m in muri.modules)m.render()}}).start()})};return muri}();window.onload=muri.start;"use strict";var muri=function(){kontra.init("js13k-2017");kontra.assets.imagePath="assets/images";var muri={};var bg=function(room){return kontra.sprite({x:0,y:0,image:kontra.assets.images["room_"+room]})};muri.modules=[];muri.start=function(){kontra.assets.load("player.png","room_stasis_dark.png","room_stasis.png").then(function(){document.getElementById("loading").style.display="none";if(kontra.store.get("current-room")===null)kontra.store.set("current-room","stasis_dark");var rooms={stasis_dark:bg("stasis_dark"),stasis:bg("stasis")};kontra.gameLoop({update:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].update();for(m in muri.modules)m.update()},render:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].render();for(m in muri.modules)m.render()}}).start()})};return muri}();window.onload=muri.start;"use strict";var muri=function(){kontra.init("js13k-2017");kontra.assets.imagePath="assets/images";var muri={};var bg=function(room){return kontra.sprite({x:0,y:0,image:kontra.assets.images["room_"+room]})};muri.modules=[];muri.start=function(){kontra.assets.load("player.png","room_stasis_dark.png","room_stasis.png").then(function(){document.getElementById("loading").style.display="none";if(kontra.store.get("current-room")===null)kontra.store.set("current-room","stasis_dark");var rooms={stasis_dark:bg("stasis_dark"),stasis:bg("stasis")};kontra.gameLoop({update:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].update();for(m in muri.modules)m.update()},render:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].render();for(m in muri.modules)m.render()}}).start()})};return muri}();window.onload=muri.start;"use strict";var muri=function(){kontra.init("js13k-2017");kontra.assets.imagePath="assets/images";var muri={};var bg=function(room){return kontra.sprite({x:0,y:0,image:kontra.assets.images["room_"+room]})};muri.modules=[];muri.start=function(){kontra.assets.load("player.png","room_stasis_dark.png","room_stasis.png").then(function(){document.getElementById("loading").style.display="none";if(kontra.store.get("current-room")===null)kontra.store.set("current-room","stasis_dark");var rooms={stasis_dark:bg("stasis_dark"),stasis:bg("stasis")};kontra.gameLoop({update:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].update();for(m in muri.modules)m.update()},render:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].render();for(m in muri.modules)m.render()}}).start()})};return muri}();window.onload=muri.start;"use strict";var muri=function(){kontra.init("js13k-2017");kontra.assets.imagePath="assets/images";var muri={};var bg=function(room){return kontra.sprite({x:0,y:0,image:kontra.assets.images["room_"+room]})};muri.modules=[];muri.start=function(){kontra.assets.load("player.png","room_stasis_dark.png","room_stasis.png").then(function(){document.getElementById("loading").style.display="none";if(kontra.store.get("current-room")===null)kontra.store.set("current-room","stasis_dark");var rooms={stasis_dark:bg("stasis_dark"),stasis:bg("stasis")};kontra.gameLoop({update:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].update();for(m in muri.modules)m.update()},render:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].render();for(m in muri.modules)m.render()}}).start()})};return muri}();window.onload=muri.start;"use strict";var muri=function(){kontra.init("js13k-2017");kontra.assets.imagePath="assets/images";var muri={};var bg=function(room){return kontra.sprite({x:0,y:0,image:kontra.assets.images["room_"+room]})};muri.modules=[];muri.start=function(){kontra.assets.load("player.png","room_stasis_dark.png","room_stasis.png").then(function(){document.getElementById("loading").style.display="none";if(kontra.store.get("current-room")===null)kontra.store.set("current-room","stasis_dark");var rooms={stasis_dark:bg("stasis_dark"),stasis:bg("stasis")};kontra.gameLoop({update:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].update();for(m in muri.modules)m.update()},render:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].render();for(m in muri.modules)m.render()}}).start()})};return muri}();window.onload=muri.start;"use strict";var muri=function(){kontra.init("js13k-2017");kontra.assets.imagePath="assets/images";var muri={};var bg=function(room){return kontra.sprite({x:0,y:0,image:kontra.assets.images["room_"+room]})};muri.modules=[];muri.start=function(){kontra.assets.load("player.png","room_stasis_dark.png","room_stasis.png").then(function(){document.getElementById("loading").style.display="none";if(kontra.store.get("current-room")===null)kontra.store.set("current-room","stasis_dark");var rooms={stasis_dark:bg("stasis_dark"),stasis:bg("stasis")};kontra.gameLoop({update:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].update();for(m in muri.modules)m.update()},render:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].render();for(m in muri.modules)m.render()}}).start()})};return muri}();window.onload=muri.start;"use strict";var muri=function(){kontra.init("js13k-2017");kontra.assets.imagePath="assets/images";var muri={};var bg=function(room){return kontra.sprite({x:0,y:0,image:kontra.assets.images["room_"+room]})};muri.modules=[];muri.start=function(){kontra.assets.load("player.png","room_stasis_dark.png","room_stasis.png").then(function(){document.getElementById("loading").style.display="none";if(kontra.store.get("current-room")===null)kontra.store.set("current-room","stasis_dark");var rooms={stasis_dark:bg("stasis_dark"),stasis:bg("stasis")};kontra.gameLoop({update:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].update();for(m in muri.modules)m.update()},render:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].render();for(m in muri.modules)m.render()}}).start()})};return muri}();window.onload=muri.start;"use strict";var muri=function(){kontra.init("js13k-2017");kontra.assets.imagePath="assets/images";var muri={};var bg=function(room){return kontra.sprite({x:0,y:0,image:kontra.assets.images["room_"+room]})};muri.modules=[];muri.start=function(){kontra.assets.load("player.png","room_stasis_dark.png","room_stasis.png").then(function(){document.getElementById("loading").style.display="none";if(kontra.store.get("current-room")===null)kontra.store.set("current-room","stasis_dark");var rooms={stasis_dark:bg("stasis_dark"),stasis:bg("stasis")};kontra.gameLoop({update:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].update();for(m in muri.modules)m.update()},render:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].render();for(m in muri.modules)m.render()}}).start()})};return muri}();window.onload=muri.start;"use strict";var muri=function(){kontra.init("js13k-2017");kontra.assets.imagePath="assets/images";var muri={};var bg=function(room){return kontra.sprite({x:0,y:0,image:kontra.assets.images["room_"+room]})};muri.modules=[];muri.start=function(){kontra.assets.load("player.png","room_stasis_dark.png","room_stasis.png").then(function(){document.getElementById("loading").style.display="none";if(kontra.store.get("current-room")===null)kontra.store.set("current-room","stasis_dark");var rooms={stasis_dark:bg("stasis_dark"),stasis:bg("stasis")};kontra.gameLoop({update:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].update();for(m in muri.modules)m.update()},render:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].render();for(m in muri.modules)m.render()}}).start()})};return muri}();window.onload=muri.start;"use strict";var muri=function(){kontra.init("js13k-2017");kontra.assets.imagePath="assets/images";var muri={};var bg=function(room){return kontra.sprite({x:0,y:0,image:kontra.assets.images["room_"+room]})};muri.modules=[];muri.start=function(){kontra.assets.load("player.png","room_stasis_dark.png","room_stasis.png").then(function(){document.getElementById("loading").style.display="none";if(kontra.store.get("current-room")===null)kontra.store.set("current-room","stasis_dark");var rooms={stasis_dark:bg("stasis_dark"),stasis:bg("stasis")};kontra.gameLoop({update:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].update();for(m in muri.modules)m.update()},render:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].render();for(m in muri.modules)m.render()}}).start()})};return muri}();window.onload=muri.start;"use strict";var muri=function(){kontra.init("js13k-2017");kontra.assets.imagePath="assets/images";var muri={};var bg=function(room){return kontra.sprite({x:0,y:0,image:kontra.assets.images["room_"+room]})};muri.modules=[];muri.start=function(){kontra.assets.load("player.png","room_stasis_dark.png","room_stasis.png").then(function(){document.getElementById("loading").style.display="none";if(kontra.store.get("current-room")===null)kontra.store.set("current-room","stasis_dark");var rooms={stasis_dark:bg("stasis_dark"),stasis:bg("stasis")};kontra.gameLoop({update:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].update();for(m in muri.modules)m.update()},render:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].render();for(m in muri.modules)m.render()}}).start()})};return muri}();window.onload=muri.start;"use strict";var muri=function(){kontra.init("js13k-2017");kontra.assets.imagePath="assets/images";var muri={};var bg=function(room){return kontra.sprite({x:0,y:0,image:kontra.assets.images["room_"+room]})};muri.modules=[];muri.start=function(){kontra.assets.load("player.png","room_stasis_dark.png","room_stasis.png").then(function(){document.getElementById("loading").style.display="none";if(kontra.store.get("current-room")===null)kontra.store.set("current-room","stasis_dark");var rooms={stasis_dark:bg("stasis_dark"),stasis:bg("stasis")};kontra.gameLoop({update:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].update();for(m in muri.modules)m.update()},render:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].render();for(m in muri.modules)m.render()}}).start()})};return muri}();window.onload=muri.start;"use strict";var muri=function(){kontra.init("js13k-2017");kontra.assets.imagePath="assets/images";var muri={};var bg=function(room){return kontra.sprite({x:0,y:0,image:kontra.assets.images["room_"+room]})};muri.modules=[];muri.start=function(){kontra.assets.load("player.png","room_stasis_dark.png","room_stasis.png").then(function(){document.getElementById("loading").style.display="none";if(kontra.store.get("current-room")===null)kontra.store.set("current-room","stasis_dark");var rooms={stasis_dark:bg("stasis_dark"),stasis:bg("stasis")};kontra.gameLoop({update:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].update();for(m in muri.modules)m.update()},render:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].render();for(m in muri.modules)m.render()}}).start()})};return muri}();window.onload=muri.start;"use strict";var muri=function(){kontra.init("js13k-2017");kontra.assets.imagePath="assets/images";var muri={};var bg=function(room){return kontra.sprite({x:0,y:0,image:kontra.assets.images["room_"+room]})};muri.modules=[];muri.start=function(){kontra.assets.load("player.png","room_stasis_dark.png","room_stasis.png").then(function(){document.getElementById("loading").style.display="none";if(kontra.store.get("current-room")===null)kontra.store.set("current-room","stasis_dark");var rooms={stasis_dark:bg("stasis_dark"),stasis:bg("stasis")};kontra.gameLoop({update:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].update();for(m in muri.modules)m.update()},render:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].render();for(m in muri.modules)m.render()}}).start()})};return muri}();window.onload=muri.start;"use strict";var muri=function(){kontra.init("js13k-2017");kontra.assets.imagePath="assets/images";var muri={};var bg=function(room){return kontra.sprite({x:0,y:0,image:kontra.assets.images["room_"+room]})};muri.modules=[];muri.start=function(){kontra.assets.load("player.png","room_stasis_dark.png","room_stasis.png").then(function(){document.getElementById("loading").style.display="none";if(kontra.store.get("current-room")===null)kontra.store.set("current-room","stasis_dark");var rooms={stasis_dark:bg("stasis_dark"),stasis:bg("stasis")};kontra.gameLoop({update:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].update();for(m in muri.modules)m.update()},render:function(){var currentRoom=kontra.store.get("current-room");rooms[currentRoom].render();for(m in muri.modules)m.render()}}).start()})};return muri}();window.onload=muri.start; \ No newline at end of file diff --git a/src/vendor/kontra.min.js b/src/vendor/kontra.min.js new file mode 100644 index 0000000..365f92f --- /dev/null +++ b/src/vendor/kontra.min.js @@ -0,0 +1,12 @@ +/* + * Kontra.js v3.0.0 (Custom Build on 2017-08-21) | MIT + * Build: https://straker.github.io/kontra/download?files=gameLoop+keyboard+sprite+assets+pool+spriteSheet+store + */ +this.kontra={init:function(n){var t=this.canvas=document.getElementById(n)||n||document.querySelector("canvas");if(!this._isCanvas(t))throw Error("You must provide a canvas element for the game");this.context=t.getContext("2d")},_noop:new Function,_isString:function(n){return""+n===n},_isNumber:function(n){return+n===n},_isFunc:function(n){return"function"==typeof n},_isImage:function(n){return!!n&&"IMG"===n.nodeName||this._isCanvas(n)},_isCanvas:function(n){return!!n&&"CANVAS"===n.nodeName}}; +!function(e,n,t){e.gameLoop=function(o){function r(){if(i=n(r),c=t.now(),u=c-a,a=c,!(u>1e3)){for(s+=u;s>=d;)h.update(f),s-=d;m(),h.render()}}if(o=o||{},!e._isFunc(o.update)||!e._isFunc(o.render))throw Error("You must provide update() and render() functions");var a,i,c,u,p=o.fps||60,s=0,d=1e3/p,f=1/p,m=o.clearCanvas===!1?e._noop:function(){e.context.clearRect(0,0,e.canvas.width,e.canvas.height)},h={update:o.update,render:o.render,isStopped:!0,start:function(){a=t.now(),this.isStopped=!1,n(r)},stop:function(){this.isStopped=!0,cancelAnimationFrame(i)},_frame:r,set _last(e){a=e}};return h}}(kontra,requestAnimationFrame,performance); +!function(){function n(n){var r=i[n.which];t[r]=!0,o[r]&&o[r](n)}function r(n){var r=i[n.which];t[r]=!1}function e(n){t={}}for(var o={},t={},i={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"delete",91:"leftwindow",92:"rightwindow",93:"select",144:"numlock",145:"scrolllock",106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},a=0;a<26;a++)i[65+a]=(10+a).toString(36);for(a=0;a<10;a++)i[48+a]=""+a,i[96+a]="numpad"+a;for(a=1;a<20;a++)i[111+a]="f"+a;var c=window.addEventListener;c("keydown",n),c("keyup",r),c("blur",e),kontra.keys={bind:function(n,r){n=Array.isArray(n)?n:[n];for(var e,t=0;e=n[t];t++)o[e]=r},unbind:function(n){n=Array.isArray(n)?n:[n];for(var r,e=0;r=n[e];e++)o[r]=null},pressed:function(n){return!!t[n]}}}(); +!function(t,i,n){t.vector=function(i,n){var e=Object.create(t.vector.prototype);return e._init(i,n),e},t.vector.prototype={_init:function(t,i){this._x=t||0,this._y=i||0},add:function(t,i){this._x+=(t.x||0)*(i||1),this._y+=(t.y||0)*(i||1)},clamp:function(t,i,e,c){this._clamp=!0,this._xMin=void 0!==t?t:-n,this._yMin=void 0!==i?i:-n,this._xMax=void 0!==e?e:n,this._yMax=void 0!==c?c:n},get x(){return this._x},get y(){return this._y},set x(t){this._x=this._clamp?i.min(i.max(this._xMin,t),this._xMax):t},set y(t){this._y=this._clamp?i.min(i.max(this._yMin,t),this._yMax):t}},t.sprite=function(i){var n=Object.create(t.sprite.prototype);return n.init(i),n},t.sprite.prototype={init:function(i){var n,e,c,o=this;i=i||{},o.position=o.position||t.vector(),o.velocity=o.velocity||t.vector(),o.acceleration=o.acceleration||t.vector(),o.position._init(i.x,i.y),o.velocity._init(i.dx,i.dy),o.acceleration._init(i.ddx,i.ddy),o.width=o.height=0;for(var s in i)o[s]=i[s];if(o.ttl=i.ttl||0,o.context=i.context||t.context,o.advance=o._advance,o.draw=o._draw,t._isImage(n=i.image))o.image=n,o.width=n.width,o.height=n.height,o.draw=o._drawImg;else if(n=i.animations){o.animations={};for(var h in n)e=n[h],o.animations[h]=e.clone?e.clone():e,c||(c=o.animations[h]);o.currentAnimation=c,o.width=c.width,o.height=c.height,o.advance=o._advanceAnim,o.draw=o._drawAnim}},get x(){return this.position.x},get y(){return this.position.y},get dx(){return this.velocity.x},get dy(){return this.velocity.y},get ddx(){return this.acceleration.x},get ddy(){return this.acceleration.y},set x(t){this.position.x=t},set y(t){this.position.y=t},set dx(t){this.velocity.x=t},set dy(t){this.velocity.y=t},set ddx(t){this.acceleration.x=t},set ddy(t){this.acceleration.y=t},isAlive:function(){return this.ttl>0},collidesWith:function(t){return this.xt.x&&this.yt.y},update:function(t){this.advance(t)},render:function(){this.draw()},playAnimation:function(t){this.currentAnimation=this.animations[t]},_advance:function(t){this.velocity.add(this.acceleration,t),this.position.add(this.velocity,t),this.ttl--},_advanceAnim:function(t){this._advance(t),this.currentAnimation.update(t)},_draw:function(){this.context.fillStyle=this.color,this.context.fillRect(this.x,this.y,this.width,this.height)},_drawImg:function(){this.context.drawImage(this.image,this.x,this.y)},_drawAnim:function(){this.currentAnimation.render({context:this.context,x:this.x,y:this.y})}}}(kontra,Math,1/0); +!function(a){function n(){for(var a=[],n=0;n=h;)if(e=this.objects[i],e.update(t),e.isAlive())i--;else{for(var n=i;n>0;n--)this.objects[n]=this.objects[n-1];this.objects[0]=e,c--,h++}},render:function(){for(var t=Math.max(this.objects.length-c,0),e=s;e>=t;e--)this.objects[e].render&&this.objects[e].render()}}}}(kontra); +!function(t){t.animation=function(i){var e=Object.create(t.animation.prototype);return e._init(i),e},t.animation.prototype={_init:function(t){t=t||{},this.spriteSheet=t.spriteSheet,this.frames=t.frames,this.frameRate=t.frameRate;var i=t.spriteSheet.frame;this.width=i.width,this.height=i.height,this.margin=i.margin||0,this._frame=0,this._accum=0},clone:function(){return t.animation(this)},update:function(t){for(t=t||1/60,this._accum+=t;this._accum*this.frameRate>=1;)this._frame=++this._frame%this.frames.length,this._accum-=1/this.frameRate},render:function(i){i=i||{};var e=i.context||t.context,r=this.frames[this._frame]/this.spriteSheet.framesPerRow|0,a=this.frames[this._frame]%this.spriteSheet.framesPerRow|0;e.drawImage(this.spriteSheet.image,a*this.width+(2*a+1)*this.margin,r*this.height+(2*r+1)*this.margin,this.width,this.height,i.x,i.y,this.width,this.height)}},t.spriteSheet=function(i){var e=Object.create(t.spriteSheet.prototype);return e._init(i),e},t.spriteSheet.prototype={_init:function(i){if(i=i||{},!t._isImage(i.image))throw Erorr("You must provide an Image for the SpriteSheet");this.animations={},this.image=i.image,this.frame={width:i.frameWidth,height:i.frameHeight,margin:i.frameMargin},this.framesPerRow=i.image.width/i.frameWidth|0,this.createAnimations(i.animations)},createAnimations:function(i){var e,r,a,h;for(var s in i){if(e=i[s],r=e.frames,a=e.frameRate,h=[],void 0===r)throw Error("Animation "+s+" must provide a frames property");Array.isArray(r)||(r=[r]);for(var n,m=0;n=r[m];m++)h.push.apply(h,this._parse(n));this.animations[s]=t.animation({spriteSheet:this,frames:h,frameRate:a})}},_parse:function(e){if(t._isNumber(e))return[e];var r=[],a=e.split(".."),h=i=+a[0],s=+a[1];if(h=s;i--)r.push(i);return r}}}(kontra); +kontra.store={set:function(t,e){void 0===e?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(e))},get:function(t){var e=localStorage.getItem(t);try{e=JSON.parse(e)}catch(o){}return e}}; \ No newline at end of file