-
Notifications
You must be signed in to change notification settings - Fork 3
/
compiled.js
135 lines (135 loc) · 62.7 KB
/
compiled.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
(function(a){Number.prototype.map=function(a,b,c,d){return c+(d-c)*((this-a)/(b-a))};Number.prototype.limit=function(a,b){return Math.min(b,Math.max(a,this))};Number.prototype.round=function(a){a=Math.pow(10,a||0);return Math.round(this*a)/a};Number.prototype.floor=function(){return Math.floor(this)};Number.prototype.ceil=function(){return Math.ceil(this)};Number.prototype.toInt=function(){return this|0};Number.prototype.toRad=function(){return this/180*Math.PI};Number.prototype.toDeg=function(){return 180*
this/Math.PI};Array.prototype.erase=function(a){for(var b=this.length;b--;)this[b]===a&&this.splice(b,1);return this};Array.prototype.random=function(){return this[Math.floor(Math.random()*this.length)]};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 b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},f=function(){return c.apply(this instanceof d&&a?
this:a,b.concat(Array.prototype.slice.call(arguments)))};d.prototype=this.prototype;f.prototype=new d;return f};a.ig={game:null,debug:null,version:"1.21",global:a,modules:{},resources:[],ready:!1,baked:!1,nocache:"",ua:{},prefix:a.ImpactPrefix||"",lib:"lib/",_current:null,_loadQueue:[],_waitForOnload:0,$:function(a){return"#"==a.charAt(0)?document.getElementById(a.substr(1)):document.getElementsByTagName(a)},$new:function(a){return document.createElement(a)},copy:function(a){if(!a||"object"!=typeof a||
a instanceof HTMLElement||a instanceof ig.Class)return a;if(a instanceof Array)for(var b=[],c=0,d=a.length;c<d;c++)b[c]=ig.copy(a[c]);else for(c in b={},a)b[c]=ig.copy(a[c]);return b},merge:function(a,b){for(var c in b){var d=b[c];if("object"!=typeof d||d instanceof HTMLElement||d instanceof ig.Class)a[c]=d;else{if(!a[c]||"object"!=typeof a[c])a[c]=d instanceof Array?[]:{};ig.merge(a[c],d)}}return a},ksort:function(a){if(!a||"object"!=typeof a)return[];var b=[],c=[],d;for(d in a)b.push(d);b.sort();
for(d=0;d<b.length;d++)c.push(a[b[d]]);return c},setVendorAttribute:function(a,b,c){var d=b.charAt(0).toUpperCase()+b.substr(1);a[b]=a["ms"+d]=a["moz"+d]=a["webkit"+d]=a["o"+d]=c},getVendorAttribute:function(a,b){var c=b.charAt(0).toUpperCase()+b.substr(1);return a[b]||a["ms"+c]||a["moz"+c]||a["webkit"+c]||a["o"+c]},normalizeVendorAttribute:function(a,b){var c=ig.getVendorAttribute(a,b);!a[b]&&c&&(a[b]=c)},getImagePixels:function(a,b,c,d,f){var e=ig.$new("canvas");e.width=a.width;e.height=a.height;
var g=e.getContext("2d"),p=ig.getVendorAttribute(g,"backingStorePixelRatio")||1;ig.normalizeVendorAttribute(g,"getImageDataHD");var s=a.width/p,q=a.height/p;e.width=Math.ceil(s);e.height=Math.ceil(q);g.drawImage(a,0,0,s,q);return 1===p?g.getImageData(b,c,d,f):g.getImageDataHD(b,c,d,f)},module:function(a){if(ig._current)throw"Module '"+ig._current.name+"' defines nothing";if(ig.modules[a]&&ig.modules[a].body)throw"Module '"+a+"' is already defined";ig._current={name:a,requires:[],loaded:!1,body:null};
ig.modules[a]=ig._current;ig._loadQueue.push(ig._current);return ig},requires:function(){ig._current.requires=Array.prototype.slice.call(arguments);return ig},defines:function(a){ig._current.body=a;ig._current=null;ig._initDOMReady()},addResource:function(a){ig.resources.push(a)},setNocache:function(a){ig.nocache=a?"?"+Date.now():""},log:function(){},assert:function(){},show:function(){},mark:function(){},_loadScript:function(a,b){ig.modules[a]={name:a,requires:[],loaded:!1,body:null};ig._waitForOnload++;
var c=ig.prefix+ig.lib+a.replace(/\./g,"/")+".js"+ig.nocache,d=ig.$new("script");d.type="text/javascript";d.src=c;d.onload=function(){ig._waitForOnload--;ig._execModules()};d.onerror=function(){throw"Failed to load module "+a+" at "+c+" required from "+b;};ig.$("head")[0].appendChild(d)},_execModules:function(){for(var a=!1,b=0;b<ig._loadQueue.length;b++){for(var c=ig._loadQueue[b],d=!0,f=0;f<c.requires.length;f++){var e=c.requires[f];ig.modules[e]?ig.modules[e].loaded||(d=!1):(d=!1,ig._loadScript(e,
c.name))}d&&c.body&&(ig._loadQueue.splice(b,1),c.loaded=!0,c.body(),a=!0,b--)}if(a)ig._execModules();else if(!ig.baked&&0==ig._waitForOnload&&0!=ig._loadQueue.length){a=[];for(b=0;b<ig._loadQueue.length;b++){d=[];e=ig._loadQueue[b].requires;for(f=0;f<e.length;f++)c=ig.modules[e[f]],(!c||!c.loaded)&&d.push(e[f]);a.push(ig._loadQueue[b].name+" (requires: "+d.join(", ")+")")}throw"Unresolved (circular?) dependencies. Most likely there's a name/path mismatch for one of the listed modules:\n"+a.join("\n");
}},_DOMReady:function(){if(!ig.modules["dom.ready"].loaded){if(!document.body)return setTimeout(ig._DOMReady,13);ig.modules["dom.ready"].loaded=!0;ig._waitForOnload--;ig._execModules()}return 0},_boot:function(){document.location.href.match(/\?nocache/)&&ig.setNocache(!0);ig.ua.pixelRatio=a.devicePixelRatio||1;ig.ua.viewport={width:a.innerWidth,height:a.innerHeight};ig.ua.screen={width:a.screen.availWidth*ig.ua.pixelRatio,height:a.screen.availHeight*ig.ua.pixelRatio};ig.ua.iPhone=/iPhone/i.test(navigator.userAgent);
ig.ua.iPhone4=ig.ua.iPhone&&2==ig.ua.pixelRatio;ig.ua.iPad=/iPad/i.test(navigator.userAgent);ig.ua.android=/android/i.test(navigator.userAgent);ig.ua.iOS=ig.ua.iPhone||ig.ua.iPad;ig.ua.mobile=ig.ua.iOS||ig.ua.android},_initDOMReady:function(){ig.modules["dom.ready"]?ig._execModules():(ig._boot(),ig.modules["dom.ready"]={requires:[],loaded:!1,body:null},ig._waitForOnload++,"complete"===document.readyState?ig._DOMReady():(document.addEventListener("DOMContentLoaded",ig._DOMReady,!1),a.addEventListener("load",
ig._DOMReady,!1)))}};ig.normalizeVendorAttribute(a,"requestAnimationFrame");if(a.requestAnimationFrame){var b=1,c={};a.ig.setAnimation=function(d,f){var e=b++;c[e]=!0;var h=function(){c[e]&&(a.requestAnimationFrame(h,f),d())};a.requestAnimationFrame(h,f);return e};a.ig.clearAnimation=function(a){delete c[a]}}else a.ig.setAnimation=function(b){return a.setInterval(b,1E3/60)},a.ig.clearAnimation=function(b){a.clearInterval(b)};var d=!1,f=/xyz/.test(function(){xyz})?/\bparent\b/:/.*/;a.ig.Class=function(){};
var e=function(a){var b=this.prototype,c={},d;for(d in a)"function"==typeof a[d]&&"function"==typeof b[d]&&f.test(a[d])?(c[d]=b[d],b[d]=function(a,b){return function(){var d=this.parent;this.parent=c[a];var f=b.apply(this,arguments);this.parent=d;return f}}(d,a[d])):b[d]=a[d]};a.ig.Class.extend=function(b){function c(){if(!d){if(this.staticInstantiate){var a=this.staticInstantiate.apply(this,arguments);if(a)return a}for(var b in this)"object"==typeof this[b]&&(this[b]=ig.copy(this[b]));this.init&&
this.init.apply(this,arguments)}return this}var j=this.prototype;d=!0;var h=new this;d=!1;for(var k in b)h[k]="function"==typeof b[k]&&"function"==typeof j[k]&&f.test(b[k])?function(a,b){return function(){var c=this.parent;this.parent=j[a];var d=b.apply(this,arguments);this.parent=c;return d}}(k,b[k]):b[k];c.prototype=h;c.prototype.constructor=c;c.extend=a.ig.Class.extend;c.inject=e;return c}})(window);ig.baked=!0;
ig.module("impact.image").defines(function(){ig.Image=ig.Class.extend({data:null,width:0,height:0,loaded:!1,failed:!1,loadCallback:null,path:"",staticInstantiate:function(a){return ig.Image.cache[a]||null},init:function(a){this.path=a;this.load()},load:function(a){this.loaded?a&&a(this.path,!0):(!this.loaded&&ig.ready?(this.loadCallback=a||null,this.data=new Image,this.data.onload=this.onload.bind(this),this.data.onerror=this.onerror.bind(this),this.data.src=ig.prefix+this.path+ig.nocache):ig.addResource(this),
ig.Image.cache[this.path]=this)},reload:function(){this.loaded=!1;this.data=new Image;this.data.onload=this.onload.bind(this);this.data.src=this.path+"?"+Date.now()},onload:function(){this.width=this.data.width;this.height=this.data.height;this.loaded=!0;1!=ig.system.scale&&this.resize(ig.system.scale);this.loadCallback&&this.loadCallback(this.path,!0)},onerror:function(){this.failed=!0;this.loadCallback&&this.loadCallback(this.path,!1)},resize:function(a){var b=ig.getImagePixels(this.data,0,0,this.width,
this.height),c=this.width*a,d=this.height*a,f=ig.$new("canvas");f.width=c;f.height=d;for(var e=f.getContext("2d"),m=e.getImageData(0,0,c,d),l=0;l<d;l++)for(var j=0;j<c;j++){var h=4*(Math.floor(l/a)*this.width+Math.floor(j/a)),k=4*(l*c+j);m.data[k]=b.data[h];m.data[k+1]=b.data[h+1];m.data[k+2]=b.data[h+2];m.data[k+3]=b.data[h+3]}e.putImageData(m,0,0);this.data=f},draw:function(a,b,c,d,f,e){if(this.loaded){var m=ig.system.scale;f=(f?f:this.width)*m;e=(e?e:this.height)*m;ig.system.context.drawImage(this.data,
c?c*m:0,d?d*m:0,f,e,ig.system.getDrawPos(a),ig.system.getDrawPos(b),f,e);ig.Image.drawCount++}},drawTile:function(a,b,c,d,f,e,m){f=f?f:d;if(this.loaded&&!(d>this.width||f>this.height)){var l=ig.system.scale,j=Math.floor(d*l),h=Math.floor(f*l),k=e?-1:1,n=m?-1:1;if(e||m)ig.system.context.save(),ig.system.context.scale(k,n);ig.system.context.drawImage(this.data,Math.floor(c*d)%this.width*l,Math.floor(c*d/this.width)*f*l,j,h,ig.system.getDrawPos(a)*k-(e?j:0),ig.system.getDrawPos(b)*n-(m?h:0),j,h);(e||
m)&&ig.system.context.restore();ig.Image.drawCount++}}});ig.Image.drawCount=0;ig.Image.cache={};ig.Image.reloadCache=function(){for(var a in ig.Image.cache)ig.Image.cache[a].reload()}});ig.baked=!0;
ig.module("impact.font").requires("impact.image").defines(function(){ig.Font=ig.Image.extend({widthMap:[],indices:[],firstChar:32,alpha:1,letterSpacing:1,lineSpacing:0,onload:function(a){this._loadMetrics(this.data);this.parent(a)},widthForString:function(a){if(-1!==a.indexOf("\n")){a=a.split("\n");for(var b=0,c=0;c<a.length;c++)b=Math.max(b,this._widthForLine(a[c]));return b}return this._widthForLine(a)},_widthForLine:function(a){for(var b=0,c=0;c<a.length;c++)b+=this.widthMap[a.charCodeAt(c)-this.firstChar]+
this.letterSpacing;return b},heightForString:function(a){return a.split("\n").length*(this.height+this.lineSpacing)},draw:function(a,b,c,d){"string"!=typeof a&&(a=a.toString());if(-1!==a.indexOf("\n")){a=a.split("\n");for(var f=this.height+this.lineSpacing,e=0;e<a.length;e++)this.draw(a[e],b,c+e*f,d)}else{if(d==ig.Font.ALIGN.RIGHT||d==ig.Font.ALIGN.CENTER)e=this._widthForLine(a),b-=d==ig.Font.ALIGN.CENTER?e/2:e;1!==this.alpha&&(ig.system.context.globalAlpha=this.alpha);for(e=0;e<a.length;e++)d=a.charCodeAt(e),
b+=this._drawChar(d-this.firstChar,b,c);1!==this.alpha&&(ig.system.context.globalAlpha=1);ig.Image.drawCount+=a.length}},_drawChar:function(a,b,c){if(!this.loaded||0>a||a>=this.indices.length)return 0;var d=ig.system.scale,f=this.widthMap[a]*d,e=(this.height-2)*d;ig.system.context.drawImage(this.data,this.indices[a]*d,0,f,e,ig.system.getDrawPos(b),ig.system.getDrawPos(c),f,e);return this.widthMap[a]+this.letterSpacing},_loadMetrics:function(a){this.height=a.height-1;this.widthMap=[];this.indices=
[];for(var b=ig.getImagePixels(a,0,a.height-1,a.width,1),c=0,d=0,f=0;f<a.width;f++){var e=4*f+3;127<b.data[e]?d++:0==b.data[e]&&d&&(this.widthMap.push(d),this.indices.push(f-d),c++,d=0)}this.widthMap.push(d);this.indices.push(f-d)}});ig.Font.ALIGN={LEFT:0,RIGHT:1,CENTER:2}});ig.baked=!0;
ig.module("impact.sound").defines(function(){ig.SoundManager=ig.Class.extend({clips:{},volume:1,format:null,init:function(){if(!ig.Sound.enabled||!window.Audio)ig.Sound.enabled=!1;else{for(var a=new Audio,b=0;b<ig.Sound.use.length;b++){var c=ig.Sound.use[b];if(a.canPlayType(c.mime)){this.format=c;break}}this.format||(ig.Sound.enabled=!1)}},load:function(a,b,c){var d=ig.prefix+a.replace(/[^\.]+$/,this.format.ext)+ig.nocache;if(this.clips[a]){if(b&&this.clips[a].length<ig.Sound.channels)for(b=this.clips[a].length;b<
ig.Sound.channels;b++){var f=new Audio(d);f.load();this.clips[a].push(f)}return this.clips[a][0]}var e=new Audio(d);c&&(e.addEventListener("canplaythrough",function l(b){e.removeEventListener("canplaythrough",l,!1);c(a,!0,b)},!1),e.addEventListener("error",function(b){c(a,!1,b)},!1));e.preload="auto";e.load();this.clips[a]=[e];if(b)for(b=1;b<ig.Sound.channels;b++)f=new Audio(d),f.load(),this.clips[a].push(f);return e},get:function(a){a=this.clips[a];for(var b=0,c;c=a[b++];)if(c.paused||c.ended)return c.ended&&
(c.currentTime=0),c;a[0].pause();a[0].currentTime=0;return a[0]}});ig.Music=ig.Class.extend({tracks:[],namedTracks:{},currentTrack:null,currentIndex:0,random:!1,_volume:1,_loop:!1,_fadeInterval:0,_fadeTimer:null,_endedCallbackBound:null,init:function(){this._endedCallbackBound=this._endedCallback.bind(this);Object.defineProperty?(Object.defineProperty(this,"volume",{get:this.getVolume.bind(this),set:this.setVolume.bind(this)}),Object.defineProperty(this,"loop",{get:this.getLooping.bind(this),set:this.setLooping.bind(this)})):
this.__defineGetter__&&(this.__defineGetter__("volume",this.getVolume.bind(this)),this.__defineSetter__("volume",this.setVolume.bind(this)),this.__defineGetter__("loop",this.getLooping.bind(this)),this.__defineSetter__("loop",this.setLooping.bind(this)))},add:function(a,b){if(ig.Sound.enabled){var c=ig.soundManager.load(a instanceof ig.Sound?a.path:a,!1);c.loop=this._loop;c.volume=this._volume;c.addEventListener("ended",this._endedCallbackBound,!1);this.tracks.push(c);b&&(this.namedTracks[b]=c);this.currentTrack||
(this.currentTrack=c)}},next:function(){this.tracks.length&&(this.stop(),this.currentIndex=this.random?Math.floor(Math.random()*this.tracks.length):(this.currentIndex+1)%this.tracks.length,this.currentTrack=this.tracks[this.currentIndex],this.play())},pause:function(){this.currentTrack&&this.currentTrack.pause()},stop:function(){this.currentTrack&&(this.currentTrack.pause(),this.currentTrack.currentTime=0)},play:function(a){if(a&&this.namedTracks[a])a=this.namedTracks[a],a!=this.currentTrack&&(this.stop(),
this.currentTrack=a);else if(!this.currentTrack)return;this.currentTrack.play()},getLooping:function(){return this._loop},setLooping:function(a){this._loop=a;for(var b in this.tracks)this.tracks[b].loop=a},getVolume:function(){return this._volume},setVolume:function(a){this._volume=a.limit(0,1);for(var b in this.tracks)this.tracks[b].volume=this._volume},fadeOut:function(a){this.currentTrack&&(clearInterval(this._fadeInterval),this.fadeTimer=new ig.Timer(a),this._fadeInterval=setInterval(this._fadeStep.bind(this),
50))},_fadeStep:function(){var a=this.fadeTimer.delta().map(-this.fadeTimer.target,0,1,0).limit(0,1)*this._volume;0.01>=a?(this.stop(),this.currentTrack.volume=this._volume,clearInterval(this._fadeInterval)):this.currentTrack.volume=a},_endedCallback:function(){this._loop?this.play():this.next()}});ig.Sound=ig.Class.extend({path:"",volume:1,currentClip:null,multiChannel:!0,init:function(a,b){this.path=a;this.multiChannel=!1!==b;this.load()},load:function(a){ig.Sound.enabled?ig.ready?ig.soundManager.load(this.path,
this.multiChannel,a):ig.addResource(this):a&&a(this.path,!0)},play:function(){ig.Sound.enabled&&(this.currentClip=ig.soundManager.get(this.path),this.currentClip.volume=ig.soundManager.volume*this.volume,this.currentClip.play())},stop:function(){this.currentClip&&(this.currentClip.pause(),this.currentClip.currentTime=0)}});ig.Sound.FORMAT={MP3:{ext:"mp3",mime:"audio/mpeg"},M4A:{ext:"m4a",mime:"audio/mp4; codecs=mp4a"},OGG:{ext:"ogg",mime:"audio/ogg; codecs=vorbis"},WEBM:{ext:"webm",mime:"audio/webm; codecs=vorbis"},
CAF:{ext:"caf",mime:"audio/x-caf"}};ig.Sound.use=[ig.Sound.FORMAT.OGG,ig.Sound.FORMAT.MP3];ig.Sound.channels=4;ig.Sound.enabled=!0});ig.baked=!0;
ig.module("impact.loader").requires("impact.image","impact.font","impact.sound").defines(function(){ig.Loader=ig.Class.extend({resources:[],gameClass:null,status:0,done:!1,_unloaded:[],_drawStatus:0,_intervalId:0,_loadCallbackBound:null,init:function(a,b){this.gameClass=a;this.resources=b;this._loadCallbackBound=this._loadCallback.bind(this);for(var c=0;c<this.resources.length;c++)this._unloaded.push(this.resources[c].path)},load:function(){ig.system.clear("#000");if(this.resources.length){for(var a=
0;a<this.resources.length;a++)this.loadResource(this.resources[a]);this._intervalId=setInterval(this.draw.bind(this),16)}else this.end()},loadResource:function(a){a.load(this._loadCallbackBound)},end:function(){this.done||(this.done=!0,clearInterval(this._intervalId),ig.system.setGame(this.gameClass))},draw:function(){this._drawStatus+=(this.status-this._drawStatus)/5;var a=ig.system.scale,b=0.6*ig.system.width,c=0.1*ig.system.height,d=0.5*ig.system.width-b/2,f=0.5*ig.system.height-c/2;ig.system.context.fillStyle=
"#000";ig.system.context.fillRect(0,0,480,320);ig.system.context.fillStyle="#fff";ig.system.context.fillRect(d*a,f*a,b*a,c*a);ig.system.context.fillStyle="#000";ig.system.context.fillRect(d*a+a,f*a+a,b*a-a-a,c*a-a-a);ig.system.context.fillStyle="#fff";ig.system.context.fillRect(d*a,f*a,b*a*this._drawStatus,c*a)},_loadCallback:function(a,b){if(b)this._unloaded.erase(a);else throw"Failed to load resource: "+a;this.status=1-this._unloaded.length/this.resources.length;0==this._unloaded.length&&setTimeout(this.end.bind(this),
250)}})});ig.baked=!0;
ig.module("impact.timer").defines(function(){ig.Timer=ig.Class.extend({target:0,base:0,last:0,pausedAt:0,init:function(a){this.last=this.base=ig.Timer.time;this.target=a||0},set:function(a){this.target=a||0;this.base=ig.Timer.time;this.pausedAt=0},reset:function(){this.base=ig.Timer.time;this.pausedAt=0},tick:function(){var a=ig.Timer.time-this.last;this.last=ig.Timer.time;return this.pausedAt?0:a},delta:function(){return(this.pausedAt||ig.Timer.time)-this.base-this.target},pause:function(){this.pausedAt||
(this.pausedAt=ig.Timer.time)},unpause:function(){this.pausedAt&&(this.base+=ig.Timer.time-this.pausedAt,this.pausedAt=0)}});ig.Timer._last=0;ig.Timer.time=Number.MIN_VALUE;ig.Timer.timeScale=1;ig.Timer.maxStep=0.05;ig.Timer.step=function(){var a=Date.now();ig.Timer.time+=Math.min((a-ig.Timer._last)/1E3,ig.Timer.maxStep)*ig.Timer.timeScale;ig.Timer._last=a}});ig.baked=!0;
ig.module("impact.system").requires("impact.timer","impact.image").defines(function(){ig.System=ig.Class.extend({fps:30,width:320,height:240,realWidth:320,realHeight:240,scale:1,tick:0,animationId:0,newGameClass:null,running:!1,delegate:null,clock:null,canvas:null,context:null,init:function(a,b,c,d,f){this.fps=b;this.clock=new ig.Timer;this.canvas=ig.$(a);this.resize(c,d,f);this.context=this.canvas.getContext("2d");this.getDrawPos=ig.System.drawMode;1!=this.scale&&(ig.System.scaleMode=ig.System.SCALE.CRISP);
ig.System.scaleMode(this.canvas,this.context)},resize:function(a,b,c){this.width=a;this.height=b;this.scale=c||this.scale;this.realWidth=this.width*this.scale;this.realHeight=this.height*this.scale;this.canvas.width=this.realWidth;this.canvas.height=this.realHeight},setGame:function(a){this.running?this.newGameClass=a:this.setGameNow(a)},setGameNow:function(a){ig.game=new a;ig.system.setDelegate(ig.game)},setDelegate:function(a){if("function"==typeof a.run)this.delegate=a,this.startRunLoop();else throw"System.setDelegate: No run() function in object";
},stopRunLoop:function(){ig.clearAnimation(this.animationId);this.running=!1},startRunLoop:function(){this.stopRunLoop();this.animationId=ig.setAnimation(this.run.bind(this),this.canvas);this.running=!0},clear:function(a){this.context.fillStyle=a;this.context.fillRect(0,0,this.realWidth,this.realHeight)},run:function(){ig.Timer.step();this.tick=this.clock.tick();this.delegate.run();ig.input.clearPressed();this.newGameClass&&(this.setGameNow(this.newGameClass),this.newGameClass=null)},getDrawPos:null});
ig.System.DRAW={AUTHENTIC:function(a){return Math.round(a)*this.scale},SMOOTH:function(a){return Math.round(a*this.scale)},SUBPIXEL:function(a){return a*this.scale}};ig.System.drawMode=ig.System.DRAW.SMOOTH;ig.System.SCALE={CRISP:function(a,b){ig.setVendorAttribute(b,"imageSmoothingEnabled",!1);a.style.imageRendering="-moz-crisp-edges";a.style.imageRendering="-o-crisp-edges";a.style.imageRendering="-webkit-optimize-contrast";a.style.imageRendering="crisp-edges";a.style.msInterpolationMode="nearest-neighbor"},
SMOOTH:function(a,b){ig.setVendorAttribute(b,"imageSmoothingEnabled",!0);a.style.imageRendering="";a.style.msInterpolationMode=""}};ig.System.scaleMode=ig.System.SCALE.SMOOTH});ig.baked=!0;
ig.module("impact.input").defines(function(){ig.KEY={MOUSE1:-1,MOUSE2:-3,MWHEEL_UP:-4,MWHEEL_DOWN:-5,BACKSPACE:8,TAB:9,ENTER:13,PAUSE:19,CAPS:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT_ARROW:37,UP_ARROW:38,RIGHT_ARROW:39,DOWN_ARROW:40,INSERT:45,DELETE:46,_0:48,_1:49,_2:50,_3:51,_4:52,_5:53,_6:54,_7:55,_8:56,_9: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,NUMPAD_0:96,NUMPAD_1:97,NUMPAD_2:98,
NUMPAD_3:99,NUMPAD_4:100,NUMPAD_5:101,NUMPAD_6:102,NUMPAD_7:103,NUMPAD_8:104,NUMPAD_9: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,SHIFT:16,CTRL:17,ALT:18,PLUS:187,COMMA:188,MINUS:189,PERIOD:190};ig.Input=ig.Class.extend({bindings:{},actions:{},presses:{},locks:{},delayedKeyup:{},isUsingMouse:!1,isUsingKeyboard:!1,isUsingAccelerometer:!1,mouse:{x:0,y:0},accel:{x:0,y:0,z:0},initMouse:function(){if(!this.isUsingMouse){this.isUsingMouse=
!0;var a=this.mousewheel.bind(this);ig.system.canvas.addEventListener("mousewheel",a,!1);ig.system.canvas.addEventListener("DOMMouseScroll",a,!1);ig.system.canvas.addEventListener("contextmenu",this.contextmenu.bind(this),!1);ig.system.canvas.addEventListener("mousedown",this.keydown.bind(this),!1);ig.system.canvas.addEventListener("mouseup",this.keyup.bind(this),!1);ig.system.canvas.addEventListener("mousemove",this.mousemove.bind(this),!1);ig.system.canvas.addEventListener("touchstart",this.keydown.bind(this),
!1);ig.system.canvas.addEventListener("touchend",this.keyup.bind(this),!1);ig.system.canvas.addEventListener("touchmove",this.mousemove.bind(this),!1)}},initKeyboard:function(){this.isUsingKeyboard||(this.isUsingKeyboard=!0,window.addEventListener("keydown",this.keydown.bind(this),!1),window.addEventListener("keyup",this.keyup.bind(this),!1))},initAccelerometer:function(){this.isUsingAccelerometer||window.addEventListener("devicemotion",this.devicemotion.bind(this),!1)},mousewheel:function(a){var b=
this.bindings[0<(a.wheelDelta?a.wheelDelta:-1*a.detail)?ig.KEY.MWHEEL_UP:ig.KEY.MWHEEL_DOWN];b&&(this.actions[b]=!0,this.presses[b]=!0,this.delayedKeyup[b]=!0,a.stopPropagation(),a.preventDefault())},mousemove:function(a){var b=parseInt(ig.system.canvas.offsetWidth)||ig.system.realWidth,b=ig.system.scale*(b/ig.system.realWidth),c={left:0,top:0};ig.system.canvas.getBoundingClientRect&&(c=ig.system.canvas.getBoundingClientRect());a=a.touches?a.touches[0]:a;this.mouse.x=(a.clientX-c.left)/b;this.mouse.y=
(a.clientY-c.top)/b},contextmenu:function(a){this.bindings[ig.KEY.MOUSE2]&&(a.stopPropagation(),a.preventDefault())},keydown:function(a){var b=a.target.tagName;if(!("INPUT"==b||"TEXTAREA"==b))if(b="keydown"==a.type?a.keyCode:2==a.button?ig.KEY.MOUSE2:ig.KEY.MOUSE1,("touchstart"==a.type||"mousedown"==a.type)&&this.mousemove(a),b=this.bindings[b])this.actions[b]=!0,this.locks[b]||(this.presses[b]=!0,this.locks[b]=!0),a.stopPropagation(),a.preventDefault()},keyup:function(a){var b=a.target.tagName;if(!("INPUT"==
b||"TEXTAREA"==b))if(b=this.bindings["keyup"==a.type?a.keyCode:2==a.button?ig.KEY.MOUSE2:ig.KEY.MOUSE1])this.delayedKeyup[b]=!0,a.stopPropagation(),a.preventDefault()},devicemotion:function(a){this.accel=a.accelerationIncludingGravity},bind:function(a,b){0>a?this.initMouse():0<a&&this.initKeyboard();this.bindings[a]=b},bindTouch:function(a,b){var c=ig.$(a),d=this;c.addEventListener("touchstart",function(a){d.touchStart(a,b)},!1);c.addEventListener("touchend",function(a){d.touchEnd(a,b)},!1)},unbind:function(a){this.delayedKeyup[this.bindings[a]]=
!0;this.bindings[a]=null},unbindAll:function(){this.bindings={};this.actions={};this.presses={};this.locks={};this.delayedKeyup={}},state:function(a){return this.actions[a]},pressed:function(a){return this.presses[a]},released:function(a){return this.delayedKeyup[a]},clearPressed:function(){for(var a in this.delayedKeyup)this.actions[a]=!1,this.locks[a]=!1;this.delayedKeyup={};this.presses={}},touchStart:function(a,b){this.actions[b]=!0;this.presses[b]=!0;a.stopPropagation();a.preventDefault();return!1},
touchEnd:function(a,b){this.delayedKeyup[b]=!0;a.stopPropagation();a.preventDefault();return!1}})});ig.baked=!0;ig.module("impact.impact").requires("dom.ready","impact.loader","impact.system","impact.input","impact.sound").defines(function(){ig.main=function(a,b,c,d,f,e,m){ig.system=new ig.System(a,c,d,f,e||1);ig.input=new ig.Input;ig.soundManager=new ig.SoundManager;ig.music=new ig.Music;ig.ready=!0;(new (m||ig.Loader)(b,ig.resources)).load()}});ig.baked=!0;
ig.module("impact.animation").requires("impact.timer","impact.image").defines(function(){ig.AnimationSheet=ig.Class.extend({width:8,height:8,image:null,init:function(a,b,c){this.width=b;this.height=c;this.image=new ig.Image(a)}});ig.Animation=ig.Class.extend({sheet:null,timer:null,sequence:[],flip:{x:!1,y:!1},pivot:{x:0,y:0},frame:0,tile:0,loopCount:0,alpha:1,angle:0,init:function(a,b,c,d){this.sheet=a;this.pivot={x:a.width/2,y:a.height/2};this.timer=new ig.Timer;this.frameTime=b;this.sequence=c;
this.stop=!!d;this.tile=this.sequence[0]},rewind:function(){this.timer.set();this.loopCount=0;this.tile=this.sequence[0];return this},gotoFrame:function(a){this.timer.set(this.frameTime*-a);this.update()},gotoRandomFrame:function(){this.gotoFrame(Math.floor(Math.random()*this.sequence.length))},update:function(){var a=Math.floor(this.timer.delta()/this.frameTime);this.loopCount=Math.floor(a/this.sequence.length);this.frame=this.stop&&0<this.loopCount?this.sequence.length-1:a%this.sequence.length;
this.tile=this.sequence[this.frame]},draw:function(a,b){var c=Math.max(this.sheet.width,this.sheet.height);a>ig.system.width||(b>ig.system.height||0>a+c||0>b+c)||(1!=this.alpha&&(ig.system.context.globalAlpha=this.alpha),0==this.angle?this.sheet.image.drawTile(a,b,this.tile,this.sheet.width,this.sheet.height,this.flip.x,this.flip.y):(ig.system.context.save(),ig.system.context.translate(ig.system.getDrawPos(a+this.pivot.x),ig.system.getDrawPos(b+this.pivot.y)),ig.system.context.rotate(this.angle),
this.sheet.image.drawTile(-this.pivot.x,-this.pivot.y,this.tile,this.sheet.width,this.sheet.height,this.flip.x,this.flip.y),ig.system.context.restore()),1!=this.alpha&&(ig.system.context.globalAlpha=1))}})});ig.baked=!0;
ig.module("impact.entity").requires("impact.animation","impact.impact").defines(function(){ig.Entity=ig.Class.extend({id:0,settings:{},size:{x:16,y:16},offset:{x:0,y:0},pos:{x:0,y:0},last:{x:0,y:0},vel:{x:0,y:0},accel:{x:0,y:0},friction:{x:0,y:0},maxVel:{x:100,y:100},zIndex:0,gravityFactor:1,standing:!1,bounciness:0,minBounceVelocity:40,anims:{},animSheet:null,currentAnim:null,health:10,type:0,checkAgainst:0,collides:0,_killed:!1,slopeStanding:{min:(44).toRad(),max:(136).toRad()},init:function(a,
b,c){this.id=++ig.Entity._lastId;this.pos.x=a;this.pos.y=b;ig.merge(this,c)},addAnim:function(a,b,c,d){if(!this.animSheet)throw"No animSheet to add the animation "+a+" to.";b=new ig.Animation(this.animSheet,b,c,d);this.anims[a]=b;this.currentAnim||(this.currentAnim=b);return b},update:function(){this.last.x=this.pos.x;this.last.y=this.pos.y;this.vel.y+=ig.game.gravity*ig.system.tick*this.gravityFactor;this.vel.x=this.getNewVelocity(this.vel.x,this.accel.x,this.friction.x,this.maxVel.x);this.vel.y=
this.getNewVelocity(this.vel.y,this.accel.y,this.friction.y,this.maxVel.y);var a=ig.game.collisionMap.trace(this.pos.x,this.pos.y,this.vel.x*ig.system.tick,this.vel.y*ig.system.tick,this.size.x,this.size.y);this.handleMovementTrace(a);this.currentAnim&&this.currentAnim.update()},getNewVelocity:function(a,b,c,d){return b?(a+b*ig.system.tick).limit(-d,d):c?(b=c*ig.system.tick,0<a-b?a-b:0>a+b?a+b:0):a.limit(-d,d)},handleMovementTrace:function(a){this.standing=!1;a.collision.y&&(0<this.bounciness&&Math.abs(this.vel.y)>
this.minBounceVelocity?this.vel.y*=-this.bounciness:(0<this.vel.y&&(this.standing=!0),this.vel.y=0));a.collision.x&&(this.vel.x=0<this.bounciness&&Math.abs(this.vel.x)>this.minBounceVelocity?this.vel.x*-this.bounciness:0);if(a.collision.slope){var b=a.collision.slope;if(0<this.bounciness){var c=this.vel.x*b.nx+this.vel.y*b.ny;this.vel.x=(this.vel.x-2*b.nx*c)*this.bounciness;this.vel.y=(this.vel.y-2*b.ny*c)*this.bounciness}else c=(this.vel.x*b.x+this.vel.y*b.y)/(b.x*b.x+b.y*b.y),this.vel.x=b.x*c,this.vel.y=
b.y*c,b=Math.atan2(b.x,b.y),b>this.slopeStanding.min&&b<this.slopeStanding.max&&(this.standing=!0)}this.pos=a.pos},draw:function(){this.currentAnim&&this.currentAnim.draw(this.pos.x-this.offset.x-ig.game._rscreen.x,this.pos.y-this.offset.y-ig.game._rscreen.y)},kill:function(){ig.game.removeEntity(this)},receiveDamage:function(a){this.health-=a;0>=this.health&&this.kill()},touches:function(a){return!(this.pos.x>=a.pos.x+a.size.x||this.pos.x+this.size.x<=a.pos.x||this.pos.y>=a.pos.y+a.size.y||this.pos.y+
this.size.y<=a.pos.y)},distanceTo:function(a){var b=this.pos.x+this.size.x/2-(a.pos.x+a.size.x/2);a=this.pos.y+this.size.y/2-(a.pos.y+a.size.y/2);return Math.sqrt(b*b+a*a)},angleTo:function(a){return Math.atan2(a.pos.y+a.size.y/2-(this.pos.y+this.size.y/2),a.pos.x+a.size.x/2-(this.pos.x+this.size.x/2))},check:function(){},collideWith:function(){},ready:function(){}});ig.Entity._lastId=0;ig.Entity.COLLIDES={NEVER:0,LITE:1,PASSIVE:2,ACTIVE:4,FIXED:8};ig.Entity.TYPE={NONE:0,A:1,B:2,BOTH:3};ig.Entity.checkPair=
function(a,b){a.checkAgainst&b.type&&a.check(b);b.checkAgainst&a.type&&b.check(a);a.collides&&(b.collides&&a.collides+b.collides>ig.Entity.COLLIDES.ACTIVE)&&ig.Entity.solveCollision(a,b)};ig.Entity.solveCollision=function(a,b){var c=null;if(a.collides==ig.Entity.COLLIDES.LITE||b.collides==ig.Entity.COLLIDES.FIXED)c=a;else if(b.collides==ig.Entity.COLLIDES.LITE||a.collides==ig.Entity.COLLIDES.FIXED)c=b;a.last.x+a.size.x>b.last.x&&a.last.x<b.last.x+b.size.x?(a.last.y<b.last.y?ig.Entity.seperateOnYAxis(a,
b,c):ig.Entity.seperateOnYAxis(b,a,c),a.collideWith(b,"y"),b.collideWith(a,"y")):a.last.y+a.size.y>b.last.y&&a.last.y<b.last.y+b.size.y&&(a.last.x<b.last.x?ig.Entity.seperateOnXAxis(a,b,c):ig.Entity.seperateOnXAxis(b,a,c),a.collideWith(b,"x"),b.collideWith(a,"x"))};ig.Entity.seperateOnXAxis=function(a,b,c){var d=a.pos.x+a.size.x-b.pos.x;c?(c.vel.x=-c.vel.x*c.bounciness+(a===c?b:a).vel.x,b=ig.game.collisionMap.trace(c.pos.x,c.pos.y,c==a?-d:d,0,c.size.x,c.size.y),c.pos.x=b.pos.x):(c=(a.vel.x-b.vel.x)/
2,a.vel.x=-c,b.vel.x=c,c=ig.game.collisionMap.trace(a.pos.x,a.pos.y,-d/2,0,a.size.x,a.size.y),a.pos.x=Math.floor(c.pos.x),a=ig.game.collisionMap.trace(b.pos.x,b.pos.y,d/2,0,b.size.x,b.size.y),b.pos.x=Math.ceil(a.pos.x))};ig.Entity.seperateOnYAxis=function(a,b,c){var d=a.pos.y+a.size.y-b.pos.y;if(c){b=a===c?b:a;c.vel.y=-c.vel.y*c.bounciness+b.vel.y;var f=0;c==a&&Math.abs(c.vel.y-b.vel.y)<c.minBounceVelocity&&(c.standing=!0,f=b.vel.x*ig.system.tick);a=ig.game.collisionMap.trace(c.pos.x,c.pos.y,f,c==
a?-d:d,c.size.x,c.size.y);c.pos.y=a.pos.y;c.pos.x=a.pos.x}else ig.game.gravity&&(b.standing||0<a.vel.y)?(c=ig.game.collisionMap.trace(a.pos.x,a.pos.y,0,-(a.pos.y+a.size.y-b.pos.y),a.size.x,a.size.y),a.pos.y=c.pos.y,0<a.bounciness&&a.vel.y>a.minBounceVelocity?a.vel.y*=-a.bounciness:(a.standing=!0,a.vel.y=0)):(c=(a.vel.y-b.vel.y)/2,a.vel.y=-c,b.vel.y=c,f=b.vel.x*ig.system.tick,c=ig.game.collisionMap.trace(a.pos.x,a.pos.y,f,-d/2,a.size.x,a.size.y),a.pos.y=c.pos.y,a=ig.game.collisionMap.trace(b.pos.x,
b.pos.y,0,d/2,b.size.x,b.size.y),b.pos.y=a.pos.y)}});ig.baked=!0;
ig.module("impact.map").defines(function(){ig.Map=ig.Class.extend({tilesize:8,width:1,height:1,data:[[]],name:null,init:function(a,b){this.tilesize=a;this.data=b;this.height=b.length;this.width=b[0].length},getTile:function(a,b){var c=Math.floor(a/this.tilesize),d=Math.floor(b/this.tilesize);return 0<=c&&c<this.width&&0<=d&&d<this.height?this.data[d][c]:0},setTile:function(a,b,c){a=Math.floor(a/this.tilesize);b=Math.floor(b/this.tilesize);0<=a&&a<this.width&&(0<=b&&b<this.height)&&(this.data[b][a]=
c)}})});ig.baked=!0;
ig.module("impact.collision-map").requires("impact.map").defines(function(){ig.CollisionMap=ig.Map.extend({lastSlope:1,tiledef:null,init:function(a,b,f){this.parent(a,b);this.tiledef=f||ig.CollisionMap.defaultTileDef;for(var e in this.tiledef)e|0>this.lastSlope&&(this.lastSlope=e|0)},trace:function(a,b,f,e,m,l){var j={collision:{x:!1,y:!1,slope:!1},pos:{x:a,y:b},tile:{x:0,y:0}},h=Math.ceil(Math.max(Math.abs(f),Math.abs(e))/this.tilesize);if(1<h)for(var k=f/h,n=e/h,g=0;g<h&&(k||n)&&!(this._traceStep(j,
a,b,k,n,m,l,f,e,g),a=j.pos.x,b=j.pos.y,j.collision.x&&(f=k=0),j.collision.y&&(e=n=0),j.collision.slope);g++);else this._traceStep(j,a,b,f,e,m,l,f,e,0);return j},_traceStep:function(a,b,f,e,m,l,j,h,k,n){a.pos.x+=e;a.pos.y+=m;var g=0;if(e){var p=0<e?l:0,s=0>e?this.tilesize:0,g=Math.max(Math.floor(f/this.tilesize),0),q=Math.min(Math.ceil((f+j)/this.tilesize),this.height);e=Math.floor((a.pos.x+p)/this.tilesize);var t=Math.floor((b+p)/this.tilesize);if(0<n||e==t||0>t||t>=this.width)t=-1;if(0<=e&&e<this.width)for(var r=
g;r<q&&!(-1!=t&&(g=this.data[r][t],1<g&&g<=this.lastSlope&&this._checkTileDef(a,g,b,f,h,k,l,j,t,r)));r++)if(g=this.data[r][e],1==g||g>this.lastSlope||1<g&&this._checkTileDef(a,g,b,f,h,k,l,j,e,r)){if(1<g&&g<=this.lastSlope&&a.collision.slope)break;a.collision.x=!0;a.tile.x=g;b=a.pos.x=e*this.tilesize-p+s;h=0;break}}if(m){p=0<m?j:0;m=0>m?this.tilesize:0;g=Math.max(Math.floor(a.pos.x/this.tilesize),0);s=Math.min(Math.ceil((a.pos.x+l)/this.tilesize),this.width);r=Math.floor((a.pos.y+p)/this.tilesize);
q=Math.floor((f+p)/this.tilesize);if(0<n||r==q||0>q||q>=this.height)q=-1;if(0<=r&&r<this.height)for(e=g;e<s&&!(-1!=q&&(g=this.data[q][e],1<g&&g<=this.lastSlope&&this._checkTileDef(a,g,b,f,h,k,l,j,e,q)));e++)if(g=this.data[r][e],1==g||g>this.lastSlope||1<g&&this._checkTileDef(a,g,b,f,h,k,l,j,e,r)){if(1<g&&g<=this.lastSlope&&a.collision.slope)break;a.collision.y=!0;a.tile.y=g;a.pos.y=r*this.tilesize-p+m;break}}},_checkTileDef:function(a,b,f,e,m,l,j,h,k,n){var g=this.tiledef[b];if(!g)return!1;b=(g[2]-
g[0])*this.tilesize;var p=(g[3]-g[1])*this.tilesize,s=g[4];j=f+m+(0>p?j:0)-(k+g[0])*this.tilesize;h=e+l+(0<b?h:0)-(n+g[1])*this.tilesize;if(0<b*h-p*j){if(0>m*-p+l*b)return s;k=Math.sqrt(b*b+p*p);n=p/k;k=-b/k;var q=j*n+h*k,g=n*q,q=k*q;if(g*g+q*q>=m*m+l*l)return s||0.5>b*(h-l)-p*(j-m);a.pos.x=f+m-g;a.pos.y=e+l-q;a.collision.slope={x:b,y:p,nx:n,ny:k};return!0}return!1}});var a=1/3,b=2/3;ig.CollisionMap.defaultTileDef={5:[0,1,1,b,!0],6:[0,b,1,a,!0],7:[0,a,1,0,!0],3:[0,1,1,0.5,!0],4:[0,0.5,1,0,!0],2:[0,
1,1,0,!0],10:[0.5,1,1,0,!0],21:[0,1,0.5,0,!0],32:[b,1,1,0,!0],43:[a,1,b,0,!0],54:[0,1,a,0,!0],27:[0,0,1,a,!0],28:[0,a,1,b,!0],29:[0,b,1,1,!0],25:[0,0,1,0.5,!0],26:[0,0.5,1,1,!0],24:[0,0,1,1,!0],11:[0,0,0.5,1,!0],22:[0.5,0,1,1,!0],33:[0,0,a,1,!0],44:[a,0,b,1,!0],55:[b,0,1,1,!0],16:[1,a,0,0,!0],17:[1,b,0,a,!0],18:[1,1,0,b,!0],14:[1,0.5,0,0,!0],15:[1,1,0,0.5,!0],13:[1,1,0,0,!0],8:[0.5,1,0,0,!0],19:[1,1,0.5,0,!0],30:[a,1,0,0,!0],41:[b,1,a,0,!0],52:[1,1,b,0,!0],38:[1,b,0,1,!0],39:[1,a,0,b,!0],40:[1,0,
0,a,!0],36:[1,0.5,0,1,!0],37:[1,0,0,0.5,!0],35:[1,0,0,1,!0],9:[1,0,0.5,1,!0],20:[0.5,0,0,1,!0],31:[1,0,b,1,!0],42:[b,0,a,1,!0],53:[a,0,0,1,!0],12:[0,0,1,0,!1],23:[1,1,0,1,!1],34:[1,0,1,1,!1],45:[0,1,0,0,!1]};ig.CollisionMap.staticNoCollision={trace:function(a,b,f,e){return{collision:{x:!1,y:!1,slope:!1},pos:{x:a+f,y:b+e},tile:{x:0,y:0}}}}});ig.baked=!0;
ig.module("impact.background-map").requires("impact.map","impact.image").defines(function(){ig.BackgroundMap=ig.Map.extend({tiles:null,scroll:{x:0,y:0},distance:1,repeat:!1,tilesetName:"",foreground:!1,enabled:!0,preRender:!1,preRenderedChunks:null,chunkSize:1024,debugChunks:!1,anims:{},init:function(a,b,c){this.parent(a,b);this.setTileset(c)},setTileset:function(a){this.tilesetName=a instanceof ig.Image?a.path:a;this.tiles=new ig.Image(this.tilesetName);this.preRenderedChunks=null},setScreenPos:function(a,
b){this.scroll.x=a/this.distance;this.scroll.y=b/this.distance},preRenderMapToChunks:function(){var a=this.width*this.tilesize*ig.system.scale,b=this.height*this.tilesize*ig.system.scale;this.chunkSize=Math.min(Math.max(a,b),this.chunkSize);var c=Math.ceil(a/this.chunkSize),d=Math.ceil(b/this.chunkSize);this.preRenderedChunks=[];for(var f=0;f<d;f++){this.preRenderedChunks[f]=[];for(var e=0;e<c;e++)this.preRenderedChunks[f][e]=this.preRenderChunk(e,f,e==c-1?a-e*this.chunkSize:this.chunkSize,f==d-1?
b-f*this.chunkSize:this.chunkSize)}},preRenderChunk:function(a,b,c,d){var f=c/this.tilesize/ig.system.scale+1,e=d/this.tilesize/ig.system.scale+1,m=a*this.chunkSize/ig.system.scale%this.tilesize,l=b*this.chunkSize/ig.system.scale%this.tilesize;a=Math.floor(a*this.chunkSize/this.tilesize/ig.system.scale);b=Math.floor(b*this.chunkSize/this.tilesize/ig.system.scale);var j=ig.$new("canvas");j.width=c;j.height=d;c=ig.system.context;ig.system.context=j.getContext("2d");for(d=0;d<f;d++)for(var h=0;h<e;h++)if(d+
a<this.width&&h+b<this.height){var k=this.data[h+b][d+a];k&&this.tiles.drawTile(d*this.tilesize-m,h*this.tilesize-l,k-1,this.tilesize)}ig.system.context=c;return j},draw:function(){this.tiles.loaded&&this.enabled&&(this.preRender?this.drawPreRendered():this.drawTiled())},drawPreRendered:function(){this.preRenderedChunks||this.preRenderMapToChunks();var a=ig.system.getDrawPos(this.scroll.x),b=ig.system.getDrawPos(this.scroll.y);if(this.repeat)var c=this.width*this.tilesize*ig.system.scale,a=(a%c+c)%
c,c=this.height*this.tilesize*ig.system.scale,b=(b%c+c)%c;var c=Math.max(Math.floor(a/this.chunkSize),0),d=Math.max(Math.floor(b/this.chunkSize),0),f=Math.ceil((a+ig.system.realWidth)/this.chunkSize),e=Math.ceil((b+ig.system.realHeight)/this.chunkSize),m=this.preRenderedChunks[0].length,l=this.preRenderedChunks.length;this.repeat||(f=Math.min(f,m),e=Math.min(e,l));for(var j=0;d<e;d++){for(var h=0,k=c;k<f;k++){var n=this.preRenderedChunks[d%l][k%m],g=-a+k*this.chunkSize-h,p=-b+d*this.chunkSize-j;ig.system.context.drawImage(n,
g,p);ig.Image.drawCount++;this.debugChunks&&(ig.system.context.strokeStyle="#f0f",ig.system.context.strokeRect(g,p,this.chunkSize,this.chunkSize));this.repeat&&(n.width<this.chunkSize&&g+n.width<ig.system.realWidth)&&(h+=this.chunkSize-n.width,f++)}this.repeat&&(n.height<this.chunkSize&&p+n.height<ig.system.realHeight)&&(j+=this.chunkSize-n.height,e++)}},drawTiled:function(){for(var a=0,b=null,c=(this.scroll.x/this.tilesize).toInt(),d=(this.scroll.y/this.tilesize).toInt(),f=this.scroll.x%this.tilesize,
e=this.scroll.y%this.tilesize,m=-f-this.tilesize,f=ig.system.width+this.tilesize-f,l=ig.system.height+this.tilesize-e,j=-1,e=-e-this.tilesize;e<l;j++,e+=this.tilesize){var h=j+d;if(h>=this.height||0>h){if(!this.repeat)continue;h=(h%this.height+this.height)%this.height}for(var k=-1,n=m;n<f;k++,n+=this.tilesize){a=k+c;if(a>=this.width||0>a){if(!this.repeat)continue;a=(a%this.width+this.width)%this.width}if(a=this.data[h][a])(b=this.anims[a-1])?b.draw(n,e):this.tiles.drawTile(n,e,a-1,this.tilesize)}}}})});
ig.baked=!0;
ig.module("impact.game").requires("impact.impact","impact.entity","impact.collision-map","impact.background-map").defines(function(){ig.Game=ig.Class.extend({clearColor:"#000000",gravity:0,screen:{x:0,y:0},_rscreen:{x:0,y:0},entities:[],namedEntities:{},collisionMap:ig.CollisionMap.staticNoCollision,backgroundMaps:[],backgroundAnims:{},autoSort:!1,sortBy:null,cellSize:64,_deferredKill:[],_levelToLoad:null,_doSortEntities:!1,staticInstantiate:function(){this.sortBy=this.sortBy||ig.Game.SORT.Z_INDEX;ig.game=
this;return null},loadLevel:function(a){this.screen={x:0,y:0};this.entities=[];this.namedEntities={};for(var b=0;b<a.entities.length;b++){var c=a.entities[b];this.spawnEntity(c.type,c.x,c.y,c.settings)}this.sortEntities();this.collisionMap=ig.CollisionMap.staticNoCollision;this.backgroundMaps=[];for(b=0;b<a.layer.length;b++)if(c=a.layer[b],"collision"==c.name)this.collisionMap=new ig.CollisionMap(c.tilesize,c.data);else{var d=new ig.BackgroundMap(c.tilesize,c.data,c.tilesetName);d.anims=this.backgroundAnims[c.tilesetName]||
{};d.repeat=c.repeat;d.distance=c.distance;d.foreground=!!c.foreground;d.preRender=!!c.preRender;d.name=c.name;this.backgroundMaps.push(d)}for(b=0;b<this.entities.length;b++)this.entities[b].ready()},loadLevelDeferred:function(a){this._levelToLoad=a},getMapByName:function(a){if("collision"==a)return this.collisionMap;for(var b=0;b<this.backgroundMaps.length;b++)if(this.backgroundMaps[b].name==a)return this.backgroundMaps[b];return null},getEntityByName:function(a){return this.namedEntities[a]},getEntitiesByType:function(a){a=
"string"===typeof a?ig.global[a]:a;for(var b=[],c=0;c<this.entities.length;c++){var d=this.entities[c];d instanceof a&&!d._killed&&b.push(d)}return b},spawnEntity:function(a,b,c,d){var f="string"===typeof a?ig.global[a]:a;if(!f)throw"Can't spawn entity of type "+a;a=new f(b,c,d||{});this.entities.push(a);a.name&&(this.namedEntities[a.name]=a);return a},sortEntities:function(){this.entities.sort(this.sortBy)},sortEntitiesDeferred:function(){this._doSortEntities=!0},removeEntity:function(a){a.name&&
delete this.namedEntities[a.name];a._killed=!0;a.type=ig.Entity.TYPE.NONE;a.checkAgainst=ig.Entity.TYPE.NONE;a.collides=ig.Entity.COLLIDES.NEVER;this._deferredKill.push(a)},run:function(){this.update();this.draw()},update:function(){this._levelToLoad&&(this.loadLevel(this._levelToLoad),this._levelToLoad=null);if(this._doSortEntities||this.autoSort)this.sortEntities(),this._doSortEntities=!1;this.updateEntities();this.checkEntities();for(var a=0;a<this._deferredKill.length;a++)this.entities.erase(this._deferredKill[a]);
this._deferredKill=[];for(var b in this.backgroundAnims){var a=this.backgroundAnims[b],c;for(c in a)a[c].update()}},updateEntities:function(){for(var a=0;a<this.entities.length;a++){var b=this.entities[a];b._killed||b.update()}},draw:function(){this.clearColor&&ig.system.clear(this.clearColor);this._rscreen.x=ig.system.getDrawPos(this.screen.x)/ig.system.scale;this._rscreen.y=ig.system.getDrawPos(this.screen.y)/ig.system.scale;var a;for(a=0;a<this.backgroundMaps.length;a++){var b=this.backgroundMaps[a];
if(b.foreground)break;b.setScreenPos(this.screen.x,this.screen.y);b.draw()}this.drawEntities();for(a;a<this.backgroundMaps.length;a++)b=this.backgroundMaps[a],b.setScreenPos(this.screen.x,this.screen.y),b.draw()},drawEntities:function(){for(var a=0;a<this.entities.length;a++)this.entities[a].draw()},checkEntities:function(){for(var a={},b=0;b<this.entities.length;b++){var c=this.entities[b];if(!(c.type==ig.Entity.TYPE.NONE&&c.checkAgainst==ig.Entity.TYPE.NONE&&c.collides==ig.Entity.COLLIDES.NEVER))for(var d=
{},f=Math.floor(c.pos.y/this.cellSize),e=Math.floor((c.pos.x+c.size.x)/this.cellSize)+1,m=Math.floor((c.pos.y+c.size.y)/this.cellSize)+1,l=Math.floor(c.pos.x/this.cellSize);l<e;l++)for(var j=f;j<m;j++)if(a[l])if(a[l][j]){for(var h=a[l][j],k=0;k<h.length;k++)c.touches(h[k])&&!d[h[k].id]&&(d[h[k].id]=!0,ig.Entity.checkPair(c,h[k]));h.push(c)}else a[l][j]=[c];else a[l]={},a[l][j]=[c]}}});ig.Game.SORT={Z_INDEX:function(a,b){return a.zIndex-b.zIndex},POS_X:function(a,b){return a.pos.x+a.size.x-(b.pos.x+
b.size.x)},POS_Y:function(a,b){return a.pos.y+a.size.y-(b.pos.y+b.size.y)}}});ig.baked=!0;ig.module("game.levels.title").requires("impact.image").defines(function(){LevelTitle={entities:[],layer:[]}});ig.baked=!0;ig.module("game.levels.main").requires("impact.image").defines(function(){LevelMain={entities:[],layer:[]}});ig.baked=!0;ig.module("game.levels.end").requires("impact.image").defines(function(){LevelEnd={entities:[],layer:[]}});ig.baked=!0;
ig.module("game.director.controller").requires("impact.impact").defines(function(){ig.Controller=ig.Class.extend({score:0,beatPoints:0,maxBeatPoints:100,randomFromTo:function(a,b){return Math.floor(Math.random()*(b-a+1)+a)},inArray:function(a,b){return-1!=a.indexOf(b)},calcPercentage:function(a,b){return 100*a/b},calcTargetPercentageValue:function(a,b){return a*b/100},pickRandomColor:function(a,b,c,d,f,e){a=this.randomFromTo(a,b);c=this.randomFromTo(c,d);f=this.randomFromTo(f,e);return{r:a,g:c,b:f}},
transitionColor:function(a,b){a>b?a-=5:a<b&&(a+=5);return a},pause:function(){ig.game.paused?ig.music.play():ig.music.pause();ig.Timer.timeScale=0===ig.Timer.timeScale?1:0;this._paused=0===ig.Timer.timeScale;ig.game.paused=!ig.game.paused}})});ig.baked=!0;
ig.module("game.entities.live").requires("impact.entity").defines(function(){EntityLive=ig.Entity.extend({checkAgainst:ig.Entity.TYPE.B,size:{x:1,y:1},kind:null,radius:1,alpha:0.8,active:!0,expansionSpeed:100,contractionSpeed:300,parentGuide:null,red:{r:255,g:0,b:0},blue:{r:0,g:144,b:255},green:{r:48,g:255,b:0},purple:{r:138,g:0,b:255},color:null,init:function(a,b,c){this.parent(a,b,c);switch(this.kind){case "red":this.color=this.red;break;case "blue":this.color=this.blue;break;case "green":this.color=
this.green;break;case "purple":this.color=this.purple}a=ig.game.getEntitiesByType(EntityGuide);for(b=0;b<a.length;b++)if(c=a[b],null===c.child&&c.kind===this.kind){this.parentGuide=c;c.child=this;c.childSet=!0;this.pos.x=c.pos.x;this.pos.y=c.pos.y;break}this.parentGuide||this.kill()},update:function(){this.parent();ig.input.state("1")&&"red"===this.kind&&this.active||ig.input.state("2")&&"blue"===this.kind&&this.active||ig.input.state("3")&&"green"===this.kind&&this.active||ig.input.state("4")&&"purple"===
this.kind&&this.active?this.radius+=this.expansionSpeed*ig.system.tick:(this.active=!1,this.radius-=this.contractionSpeed*ig.system.tick,0>=this.radius&&(this.parentGuide&&(this.parentGuide.child=null),this.kill()))},draw:function(){ig.game.ctx.save();ig.game.ctx.beginPath();ig.game.ctx.arc(this.pos.x,this.pos.y,this.radius,0,2*Math.PI,!1);ig.game.ctx.fillStyle="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.alpha+")";ig.game.ctx.fill();ig.game.ctx.lineWidth=2;ig.game.ctx.strokeStyle=
"rgba("+this.color.r+","+this.color.g+","+this.color.b+",1)";ig.game.ctx.stroke();ig.game.ctx.restore()}});EntityPoints=ig.Entity.extend({size:{x:1,y:1},kind:null,radius:1,alpha:0.8,active:!0,lifespan:3,points:null,text:null,gray:{r:171,g:171,b:171},red:{r:255,g:0,b:0},green:{r:48,g:255,b:0},init:function(a,b,c){this.parent(a,b,c);80<this.points?(this.color=this.green,this.text=100!==this.points?this.points+" - Great!":this.points+" - PERFECT!"):50>this.points?(this.color=this.red,this.text=this.points+
" - Disappointing."):(this.color=this.gray,this.text=this.points+" - Ok.")},update:function(){this.parent();this.pos.y-=0.5;this.alpha-=0.01;0.01>=this.alpha&&this.kill()},draw:function(){ig.game.ctx.save();ig.game.ctx.fillStyle="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.alpha+")";ig.game.ctx.font="19pt Arial";ig.game.ctx.fillText(this.text,this.pos.x,this.pos.y);ig.game.ctx.restore()}})});ig.baked=!0;
ig.module("game.entities.guide").requires("impact.entity").defines(function(){EntityGuide=ig.Entity.extend({size:{x:1,y:1},kind:null,radius:10,guideRadius:100,alpha:0.3,active:!1,expansionSpeed:100,contractionSpeed:300,guideContractionSpeed:100,beatPoints:0,targetTime:null,duration:null,child:null,childSet:!1,posValue:0.5,sizeValue:1,tempPoints:null,red:{r:255,g:0,b:0},blue:{r:0,g:144,b:255},green:{r:48,g:255,b:0},purple:{r:138,g:0,b:255},gray:{r:171,g:171,b:171},number:null,targetColor:null,color:null,
init:function(a,b,c){this.parent(a,b,c);ig.game.currentLevel===LevelMain&&(2===ig.game.guideBuffer?(this.guideContractionSpeed=50,this.beatGuideSpeed=0.5):1===ig.game.guideBuffer&&(this.guideContractionSpeed=100,this.beatGuideSpeed=1));switch(this.kind){case "red":this.targetColor=this.red;this.number=1;break;case "blue":this.targetColor=this.blue;this.number=2;break;case "green":this.targetColor=this.green;this.number=3;break;case "purple":this.targetColor=this.purple;this.number=4;break;case "beat":this.pos.y=
ig.system.height,this.targetColor=this.gray,this.guideContractionSpeed=this.beatGuideSpeed*ig.system.height,this.size.x=ig.system.width,this.size.y=25}this.color=this.targetColor},update:function(){this.parent();if("beat"!==this.kind)if(ig.music.currentTrack.currentTime>=this.targetTime&&ig.music.currentTrack.currentTime<=this.targetTime+this.duration?(this.active=!0,this.radius+=this.expansionSpeed*ig.system.tick):ig.music.currentTrack.currentTime>=this.targetTime&&ig.music.currentTrack.currentTime>=
this.targetTime+this.duration?(this.active=!1,this.radius-=this.contractionSpeed*ig.system.tick,0>=this.radius&&(this.childSet?(this.tempPoints=Math.round(100*this.sizeValue),ig.game.controller.score+=Math.round(this.tempPoints)):this.tempPoints=0,ig.game.spawnEntity(EntityPoints,this.pos.x,this.pos.y,{points:this.tempPoints}),this.kill())):0.5<this.guideRadius&&(this.guideRadius-=this.guideContractionSpeed*ig.system.tick),this.childSet){var a=0;this.child?(a=Math.abs(100-ig.game.controller.calcPercentage(this.child.radius,
this.radius)),a=ig.game.controller.calcTargetPercentageValue(a,this.sizeValue),a=this.active?a/200:a/400):(a=Math.abs(100-ig.game.controller.calcPercentage(0,this.radius)),a=ig.game.controller.calcTargetPercentageValue(a,this.sizeValue),a/=100);this.sizeValue=a<this.sizeValue?this.sizeValue-a:0}else this.active&&!this.childSet&&(this.sizeValue-=0.6*ig.system.tick);else-100<this.pos.y?this.pos.y-=this.guideContractionSpeed*ig.system.tick:-100>=this.pos.y&&(ig.game.spawnEntity(EntityPoints,this.pos.x,
this.pos.y+150,{points:this.beatPoints}),ig.game.controller.score+=this.beatPoints,this.kill()),ig.input.pressed("space")&&("beat"===this.kind&&30>=this.pos.y)&&(this.beatPoints=ig.game.controller.maxBeatPoints)},draw:function(){ig.game.ctx.save();"beat"!==this.kind?(0<this.guideRadius&&(ig.game.ctx.beginPath(),ig.game.ctx.arc(this.pos.x,this.pos.y,this.guideRadius,0,2*Math.PI,!1),ig.game.ctx.fillStyle="rgba("+this.gray.r+","+this.gray.g+","+this.gray.b+",0.3)",ig.game.ctx.fill()),ig.game.ctx.beginPath(),
ig.game.ctx.arc(this.pos.x,this.pos.y,this.expansionSpeed*this.duration,0,2*Math.PI,!1),ig.game.ctx.strokeStyle="rgba("+this.gray.r+","+this.gray.g+","+this.gray.b+",0.5)",ig.game.ctx.lineWidth=1.5,ig.game.ctx.stroke(),ig.game.ctx.beginPath(),ig.game.ctx.arc(this.pos.x,this.pos.y,this.radius,0,2*Math.PI,!1),ig.game.ctx.fillStyle="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.alpha+")",ig.game.ctx.fill(),ig.game.ctx.lineWidth=2,ig.game.ctx.strokeStyle="rgba("+this.color.r+","+this.color.g+
","+this.color.b+","+this.alpha+")",ig.game.ctx.stroke(),ig.game.ctx.fillStyle="white",ig.game.ctx.font="19pt Arial",ig.game.ctx.fillText(this.number,this.pos.x-7,this.pos.y+10)):(ig.game.ctx.beginPath(),ig.game.ctx.fillStyle="rgba("+this.color.r+","+this.color.g+","+this.color.b+",0.3)",ig.game.ctx.fillRect(0,this.pos.y,this.size.x,this.size.y));ig.game.ctx.restore()}})});ig.baked=!0;
ig.module("game.main").requires("impact.game","impact.font","game.levels.title","game.levels.main","game.levels.end","game.director.controller","game.entities.live","game.entities.guide").defines(function(){MyGame=ig.Game.extend({controller:new ig.Controller,font:new ig.Font("media/04b03.font.png"),virusMusic:new ig.Sound("media/virus.*",!1),titleMusic:new ig.Sound("media/titlesound.*",!1),currentLevel:null,triggerMarks:null,guideBuffer:2,beatGuideAlpha:0.3,init:function(){ig.input.bind(ig.KEY.MOUSE1,
"click");ig.input.bind(ig.KEY._1,"1");ig.input.bind(ig.KEY._2,"2");ig.input.bind(ig.KEY._3,"3");ig.input.bind(ig.KEY._4,"4");ig.input.bind(ig.KEY.SPACE,"space");ig.input.bind(ig.KEY.ESC,"pause");this.ctx=ig.system.context;ig.music.add(this.virusMusic,"virus");ig.music.add(this.titleMusic,"title");ig.music.volume=1;this.loadLevel(LevelTitle)},loadLevel:function(a){this.currentLevel=a;this.parent(a);this.tutorialMark=null;this.currentLevel===LevelMain?(this.setTriggerMarks(),this.controller.score=0,
ig.music.play("virus"),ig.music.loop=!1,this.beatGuideAlphaTimer=new ig.Timer(0.1)):(ig.music.play("title"),ig.music.loop=!0)},setTriggerMarks:function(){this.triggerMarks=[{mark:5.55,duration:2,kind:"red"},{mark:8.9,duration:2,kind:"blue"},{mark:12.09,duration:1,kind:"red"},{mark:13.71,duration:1,kind:"blue"},{mark:15.33,duration:1,kind:"green"},{mark:17.01,duration:0,kind:"beat"},{mark:18.59,duration:0,kind:"beat"},{mark:20.25,duration:0.5,kind:"purple"},{mark:21.8,duration:1,kind:"red"},{mark:22.48,
duration:0,kind:"beat"},{mark:24.11,duration:1,kind:"green"},{mark:25.15,duration:0,kind:"beat"},{mark:25.74,duration:0,kind:"beat"},{mark:26.39,duration:0,kind:"beat"},{mark:27.43,duration:1.05,kind:"blue"},{mark:29.74,duration:0,kind:"beat"},{mark:30.29,duration:0.55,kind:"purple"},{mark:31.78,duration:0.61,kind:"green"},{mark:33.41,duration:0.63,kind:"red"},{mark:35.07,duration:0.56,kind:"blue"},{mark:36.71,duration:0.57,kind:"green"},{mark:38.34,duration:0,kind:"beat"},{mark:38.99,duration:0,
kind:"beat"},{mark:39.55,duration:0,kind:"beat"},{mark:39.97,duration:0,kind:"beat"},{mark:41.63,duration:1.63,kind:"red"},{mark:44.88,duration:0,kind:"beat"},{mark:45.57,duration:0,kind:"beat"},{mark:46.13,duration:0,kind:"beat"},{mark:46.55,duration:0.68,kind:"purple"},{mark:48.18,duration:0,kind:"beat"},{mark:48.82,duration:0,kind:"beat"},{mark:49.39,duration:0,kind:"beat"},{mark:49.82,duration:0.68,kind:"blue"},{mark:51.47,duration:0,kind:"beat"},{mark:52.11,duration:0,kind:"beat"},{mark:52.68,
duration:0,kind:"beat"},{mark:53.17,duration:0.68,kind:"green"},{mark:54.76,duration:0.68,kind:"red"},{mark:56.37,duration:0.84,kind:"blue"},{mark:58.07,duration:0.61,kind:"purple"},{mark:59.28,duration:0,kind:"beat"},{mark:60.33,duration:0,kind:"beat"},{mark:61.33,duration:0.63,kind:"green"},{mark:62.57,duration:0,kind:"beat"},{mark:63,duration:0,kind:"beat"},{mark:64.61,duration:0.63,kind:"green"},{mark:66.32,duration:0,kind:"beat"},{mark:69.89,duration:0,kind:"beat"},{mark:70.25,duration:1.08,
kind:"red"},{mark:72.51,duration:0,kind:"beat"},{mark:72.92,duration:0.9,kind:"blue"},{mark:75.08,duration:0,kind:"beat"},{mark:76.19,duration:0.75,kind:"purple"},{mark:77.76,duration:0.75,kind:"purple"},{mark:79.46,duration:1.3,kind:"red"},{mark:81.01,duration:1.3,kind:"blue"},{mark:82.72,duration:1.19,kind:"blue"},{mark:84.43,duration:1.24,kind:"purple"},{mark:86.07,duration:1.21,kind:"purple"},{mark:86.53,duration:0,kind:"beat"},{mark:86.68,duration:0,kind:"beat"},{mark:87.73,duration:1.22,kind:"red"},
{mark:88.1,duration:0,kind:"beat"},{mark:88.29,duration:0,kind:"beat"},{mark:89.31,duration:1.25,kind:"purple"},{mark:90.96,duration:1.25,kind:"purple"},{mark:92.59,duration:0.77,kind:"red"},{mark:94.27,duration:0.68,kind:"blue"},{mark:95.52,duration:0,kind:"beat"},{mark:96.81,duration:0,kind:"beat"},{mark:97.65,duration:0,kind:"beat"},{mark:99.17,duration:0,kind:"beat"},{mark:100.76,duration:0,kind:"beat"},{mark:101.63,duration:0,kind:"beat"},{mark:102.03,duration:0,kind:"beat"},{mark:102.44,duration:0,
kind:"beat"},{mark:102.86,duration:0,kind:"beat"},{mark:103.29,duration:0,kind:"beat"},{mark:103.72,duration:0,kind:"beat"},{mark:104.11,duration:0,kind:"beat"},{mark:104.5,duration:0,kind:"beat"},{mark:104.86,duration:0,kind:"beat"},{mark:105.31,duration:0,kind:"beat"},{mark:105.74,duration:0,kind:"beat"},{mark:106.16,duration:0,kind:"beat"},{mark:106.59,duration:0,kind:"beat"},{mark:106.99,duration:0,kind:"beat"},{mark:107.4,duration:0,kind:"beat"},{mark:107.76,duration:0,kind:"beat"},{mark:108.21,
duration:0,kind:"beat"},{mark:108.59,duration:0,kind:"beat"},{mark:109.02,duration:3.32,kind:"red"},{mark:110.71,duration:3.27,kind:"green"},{mark:115.63,duration:1.65,kind:"purple"},{mark:117.88,duration:0,kind:"beat"},{mark:118.43,duration:0,kind:"beat"},{mark:118.9,duration:1.67,kind:"blue"},{mark:119.52,duration:1.7,kind:"green"},{mark:122.77,duration:1.1,kind:"red"},{mark:123.24,duration:0,kind:"beat"},{mark:124.41,duration:0.63,kind:"purple"},{mark:125.91,duration:1.17,kind:"blue"},{mark:126.46,
duration:1.23,kind:"green"},{mark:128.36,duration:0,kind:"beat"},{mark:129.15,duration:1.26,kind:"blue"},{mark:129.81,duration:1.26,kind:"green"},{mark:131.59,duration:0,kind:"beat"},{mark:132.41,duration:1.26,kind:"blue"},{mark:133.06,duration:1.26,kind:"green"},{mark:134.83,duration:0,kind:"beat"},{mark:135.8,duration:1.26,kind:"blue"},{mark:136.35,duration:1.26,kind:"green"},{mark:138.65,duration:0,kind:"beat"},{mark:138.87,duration:0,kind:"beat"},{mark:139.06,duration:0,kind:"beat"},{mark:139.12,
duration:1.26,kind:"blue"},{mark:139.76,duration:1.26,kind:"green"},{mark:139.76,duration:0,kind:"beat"},{mark:140.38,duration:0,kind:"beat"},{mark:141.02,duration:0,kind:"beat"},{mark:142.11,duration:0,kind:"beat"},{mark:142.32,duration:0,kind:"beat"},{mark:142.32,duration:1.26,kind:"blue"},{mark:142.94,duration:1.26,kind:"green"},{mark:145.19,duration:0,kind:"beat"},{mark:146.15,duration:0,kind:"beat"},{mark:146.84,duration:0,kind:"beat"},{mark:147.43,duration:0,kind:"beat"},{mark:148.53,duration:0.94,
kind:"red"},{mark:150.2,duration:0.56,kind:"purple"},{mark:151.43,duration:0,kind:"beat"},{mark:151.8,duration:0.77,kind:"blue"},{mark:152.23,duration:0,kind:"beat"},{mark:153.54,duration:1.18,kind:"green"},{mark:154.1,duration:0.62,kind:"red"},{mark:155.08,duration:0.92,kind:"purple"},{mark:156.76,duration:0,kind:"beat"},{mark:157.32,duration:0,kind:"beat"},{mark:157.97,duration:0,kind:"beat"},{mark:158.42,duration:0.95,kind:"green"},{mark:160.4,duration:0,kind:"beat"},{mark:161.22,duration:0,kind:"beat"},
{mark:162.04,duration:0,kind:"beat"},{mark:162.86,duration:0,kind:"beat"},{mark:163.7,duration:0,kind:"beat"},{mark:164.16,duration:0,kind:"beat"},{mark:164.35,duration:0,kind:"beat"},{mark:164.52,duration:0,kind:"beat"},{mark:164.73,duration:0,kind:"beat"},{mark:164.91,duration:1.63,kind:"blue"},{mark:166.99,duration:0,kind:"beat"},{mark:167.19,duration:0,kind:"beat"},{mark:168.24,duration:1.63,kind:"blue"},{mark:170.26,duration:0,kind:"beat"},{mark:170.47,duration:0,kind:"beat"},{mark:171.54,duration:0.58,
kind:"red"},{mark:173.13,duration:0.58,kind:"blue"},{mark:174.73,duration:1.28,kind:"green"},{mark:176.48,duration:1.28,kind:"purple"},{mark:178.13,duration:0,kind:"beat"},{mark:178.63,duration:2.72,kind:"green"},{mark:180.2,duration:1.15,kind:"red"},{mark:182.13,duration:0.93,kind:"blue"},{mark:183.73,duration:0,kind:"beat"},{mark:184.56,duration:0.81,kind:"red"},{mark:186.26,duration:0.81,kind:"purple"},{mark:187.87,duration:0.87,kind:"red"},{mark:189.51,duration:0.87,kind:"purple"},{mark:191.27,
duration:0,kind:"beat"},{mark:191.63,duration:0,kind:"beat"},{mark:192.06,duration:0,kind:"beat"},{mark:192.48,duration:0,kind:"beat"},{mark:193.65,duration:0,kind:"beat"},{mark:194.54,duration:1.68,kind:"blue"},{mark:197.82,duration:0,kind:"beat"},{mark:198.18,duration:0,kind:"beat"},{mark:198.63,duration:0,kind:"beat"},{mark:199.04,duration:0,kind:"beat"},{mark:200.29,duration:0,kind:"beat"},{mark:200.93,duration:1.78,kind:"blue"},{mark:202.71,duration:0.67,kind:"red"},{mark:204.38,duration:0,kind:"beat"},
{mark:204.76,duration:0,kind:"beat"},{mark:205.15,duration:0,kind:"beat"},{mark:205.62,duration:1.42,kind:"green"},{mark:209.32,duration:0.86,kind:"purple"},{mark:210.98,duration:1.17,kind:"green"},{mark:213.51,duration:2.29,kind:"red"},{mark:215.8,duration:0.87,kind:"green"},{mark:217.54,duration:0,kind:"beat"},{mark:217.95,duration:0,kind:"beat"},{mark:218.28,duration:0,kind:"beat"},{mark:218.7,duration:0,kind:"beat"},{mark:220.69,duration:0,kind:"beat"},{mark:223.27,duration:0,kind:"beat"},{mark:224.28,
duration:0.99,kind:"red"},{mark:227.25,duration:3.56,kind:"blue"},{mark:234.01,duration:0,kind:"beat"},{mark:235.62,duration:0,kind:"beat"}]},setTutorialMark:function(){if(this.currentLevel===LevelTitle){var a;switch(this.controller.randomFromTo(1,4)){case 1:a="red";break;case 2:a="blue";break;case 3:a="green";break;case 4:a="purple"}this.tutorialMark={mark:1,duration:1,kind:a,active:!0};this.spawnEntity(EntityGuide,ig.system.width/2-200,250,{duration:this.tutorialMark.duration,kind:this.tutorialMark.kind,
targetTime:this.tutorialMark.mark,guideContractionSpeed:100});this.tutorialMark=null}},update:function(){this.parent();ig.input.pressed("1")?this.spawnEntity(EntityLive,ig.input.mouse.x,ig.input.mouse.y,{kind:"red"}):ig.input.pressed("2")?this.spawnEntity(EntityLive,ig.input.mouse.x,ig.input.mouse.y,{kind:"blue"}):ig.input.pressed("3")?this.spawnEntity(EntityLive,ig.input.mouse.x,ig.input.mouse.y,{kind:"green"}):ig.input.pressed("4")&&this.spawnEntity(EntityLive,ig.input.mouse.x,ig.input.mouse.y,
{kind:"purple"});if(this.currentLevel===LevelTitle){ig.input.pressed("space")&&this.loadLevel(LevelMain);var a=this.getEntitiesByType(EntityGuide);0.3>=ig.music.currentTrack.currentTime&&0===a.length&&this.setTutorialMark()}else if(this.currentLevel===LevelMain){if(0<this.triggerMarks.length&&ig.music.currentTrack.currentTime>=this.triggerMarks[0].mark-this.guideBuffer){var a=this.triggerMarks[0],b=this.controller.randomFromTo(50,ig.system.width-50),c=this.controller.randomFromTo(50,ig.system.height-
50);this.spawnEntity(EntityGuide,b,c,{duration:a.duration,kind:a.kind,targetTime:a.mark});this.triggerMarks.shift()}30<=ig.music.currentTrack.currentTime&&2===this.guideBuffer&&(this.guideBuffer=1);ig.input.pressed("pause")&&this.controller.pause();ig.input.pressed("space")&&(this.beatGuideAlpha=0.5,this.beatGuideAlphaTimer.unpause());0<this.beatGuideAlphaTimer.delta()&&(this.beatGuideAlpha=0.3,this.beatGuideAlphaTimer.pause(),this.beatGuideAlphaTimer.reset());240<=ig.music.currentTrack.currentTime&&
(console.log("level end! "+ig.music.currentTrack.currentTime),this.loadLevel(LevelEnd))}else this.currentLevel===LevelEnd&&ig.input.pressed("space")&&this.loadLevel(LevelTitle)},drawTitleScreen:function(){var a=ig.system.width/2-200,b=100;this.ctx.fillStyle="#7e0302";this.ctx.font="19pt Arial";this.ctx.fillText("my mind is going",a,b);b+=30;this.ctx.fillStyle="#cccccc";this.ctx.font="14.5pt Arial";this.ctx.fillText("space to start.",a,b);b+=40;this.ctx.fillStyle="#7e0302";this.ctx.font="14.5pt Arial";
this.ctx.fillText("how:",a,b);b+=30;this.ctx.font="11pt Arial";this.ctx.fillStyle="#ffffff";this.ctx.fillText("Sustained Triggers:",a,b);b+=25;this.ctx.fillStyle="#959595";a+=60;this.ctx.fillText("+ Press number key shown in guide when gray silhouette touches guide outline.",a,b);b+=20;this.ctx.fillText("+ Hold to expand as the guide expands.",a,b);b+=20;this.ctx.fillText("+ Release to contract when guide starts contracting.",a,b);a-=60;b+=40;this.ctx.fillStyle="#ffffff";this.ctx.fillText("Beat Triggers:",
a,b);b+=15;this.ctx.fillStyle="#959595";this.ctx.save();this.ctx.beginPath();this.ctx.fillStyle="rgba(255,255,255,0.3)";this.ctx.fillRect(a,b,433,25);this.ctx.fillStyle="gray";this.ctx.font="19pt Arial";this.ctx.fillText("space",ig.system.width/2-27,b+18);this.ctx.restore();b+=40;this.ctx.fillText("Hit SPACE once when horizontal silhouette touches the guide.",a,b);this.ctx.fillStyle="#7e0302";this.ctx.font="17px Arial";this.ctx.fillText("Music by Clearside - www.clearsidemusic.com",a,b+40)},drawMainScreen:function(){this.ctx.beginPath();
this.ctx.fillStyle="rgba(255,255,255,"+this.beatGuideAlpha+")";this.ctx.fillRect(0,0,ig.system.width,25);this.ctx.fillStyle="gray";this.ctx.font="19pt Arial";this.ctx.fillText("space",ig.system.width/2-27,18);this.ctx.font="40pt Arial";this.ctx.fillText(this.controller.score,5,ig.system.height-55);this.ctx.beginPath();this.ctx.fillStyle="#7e0302";this.ctx.fillRect(0,ig.system.height-15,ig.system.width/240.55*ig.music.currentTrack.currentTime,15)},drawEndScreen:function(){var a=ig.system.width/2-200,
b=100;this.ctx.fillStyle="#7e0302";this.ctx.font="19pt Arial";this.ctx.fillText("finished",a,b);b+=30;this.ctx.fillStyle="#cccccc";this.ctx.font="14.5pt Arial";this.ctx.fillText("Score: "+this.controller.score,a,b);this.ctx.fillText("Space to try again.",a,b+40)},draw:function(){this.parent();this.currentLevel===LevelTitle?this.drawTitleScreen():this.currentLevel===LevelMain?this.drawMainScreen():this.currentLevel===LevelEnd&&this.drawEndScreen()}});ig.main("#canvas",MyGame,60,window.innerWidth,window.innerHeight,
1)});