/*! Built with IMPACT - impactjs.com */ (function(window){"use strict";Number.prototype.map=function(istart,istop,ostart,ostop){return ostart+(ostop-ostart)*((this-istart)/(istop-istart));};Number.prototype.limit=function(min,max){return Math.min(max,Math.max(min,this));};Number.prototype.round=function(precision){precision=Math.pow(10,precision||0);return Math.round(this*precision)/precision;};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(this*180)/Math.PI;};Array.prototype.erase=function(item){for(var i=this.length;i--;){if(this[i]===item){this.splice(i,1);}} return this;};Array.prototype.random=function(){return this[Math.floor(Math.random()*this.length)];};Function.prototype.bind=Function.prototype.bind||function(oThis){if(typeof this!=="function"){throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");} var aArgs=Array.prototype.slice.call(arguments,1),fToBind=this,fNOP=function(){},fBound=function(){return fToBind.apply((this instanceof fNOP&&oThis?this:oThis),aArgs.concat(Array.prototype.slice.call(arguments)));};fNOP.prototype=this.prototype;fBound.prototype=new fNOP();return fBound;};window.ig={game:null,debug:null,version:'1.23',global:window,modules:{},resources:[],ready:false,baked:false,nocache:'',ua:{},prefix:(window.ImpactPrefix||''),lib:'lib/',_current:null,_loadQueue:[],_waitForOnload:0,$:function(selector){return selector.charAt(0)=='#'?document.getElementById(selector.substr(1)):document.getElementsByTagName(selector);},$new:function(name){return document.createElement(name);},copy:function(object){if(!object||typeof(object)!='object'||object instanceof HTMLElement||object instanceof ig.Class){return object;} else if(object instanceof Array){var c=[];for(var i=0,l=object.length;ithis.width||tileHeight>this.height){return;} var scale=ig.system.scale;var tileWidthScaled=Math.floor(tileWidth*scale);var tileHeightScaled=Math.floor(tileHeight*scale);var scaleX=flipX?-1:1;var scaleY=flipY?-1:1;if(flipX||flipY){ig.system.context.save();ig.system.context.scale(scaleX,scaleY);} ig.system.context.drawImage(this.data,(Math.floor(tile*tileWidth)%this.width)*scale,(Math.floor(tile*tileWidth/this.width)*tileHeight)*scale,tileWidthScaled,tileHeightScaled,ig.system.getDrawPos(targetX)*scaleX-(flipX?tileWidthScaled:0),ig.system.getDrawPos(targetY)*scaleY-(flipY?tileHeightScaled:0),tileWidthScaled,tileHeightScaled);if(flipX||flipY){ig.system.context.restore();} ig.Image.drawCount++;}});ig.Image.drawCount=0;ig.Image.cache={};ig.Image.reloadCache=function(){for(var path in ig.Image.cache){ig.Image.cache[path].reload();}};}); // lib/impact/font.js ig.baked=true;ig.module('impact.font').requires('impact.image').defines(function(){"use strict";ig.Font=ig.Image.extend({widthMap:[],indices:[],firstChar:32,alpha:1,letterSpacing:1,lineSpacing:0,onload:function(ev){this._loadMetrics(this.data);this.parent(ev);},widthForString:function(text){if(text.indexOf('\n')!==-1){var lines=text.split('\n');var width=0;for(var i=0;i=this.indices.length){return 0;} var scale=ig.system.scale;var charX=this.indices[c]*scale;var charY=0;var charWidth=this.widthMap[c]*scale;var charHeight=(this.height-2)*scale;ig.system.context.drawImage(this.data,charX,charY,charWidth,charHeight,ig.system.getDrawPos(targetX),ig.system.getDrawPos(targetY),charWidth,charHeight);return this.widthMap[c]+this.letterSpacing;},_loadMetrics:function(image){this.height=image.height-1;this.widthMap=[];this.indices=[];var px=ig.getImagePixels(image,0,image.height-1,image.width,1);var currentChar=0;var currentWidth=0;for(var x=0;x127){currentWidth++;} else if(px.data[index]<128&¤tWidth){this.widthMap.push(currentWidth);this.indices.push(x-currentWidth);currentChar++;currentWidth=0;}} this.widthMap.push(currentWidth);this.indices.push(x-currentWidth);}});ig.Font.ALIGN={LEFT:0,RIGHT:1,CENTER:2};}); // lib/impact/sound.js ig.baked=true;ig.module('impact.sound').defines(function(){"use strict";ig.SoundManager=ig.Class.extend({clips:{},volume:1,format:null,init:function(){if(!ig.Sound.enabled||!window.Audio){ig.Sound.enabled=false;return;} var probe=new Audio();for(var i=0;i0?ig.KEY.MWHEEL_UP:ig.KEY.MWHEEL_DOWN;var action=this.bindings[code];if(action){this.actions[action]=true;this.presses[action]=true;this.delayedKeyup[action]=true;event.stopPropagation();event.preventDefault();}},mousemove:function(event){var internalWidth=parseInt(ig.system.canvas.offsetWidth)||ig.system.realWidth;var scale=ig.system.scale*(internalWidth/ig.system.realWidth);var pos={left:0,top:0};if(ig.system.canvas.getBoundingClientRect){pos=ig.system.canvas.getBoundingClientRect();} var ev=event.touches?event.touches[0]:event;this.mouse.x=(ev.clientX-pos.left)/scale;this.mouse.y=(ev.clientY-pos.top)/scale;},contextmenu:function(event){if(this.bindings[ig.KEY.MOUSE2]){event.stopPropagation();event.preventDefault();}},keydown:function(event){var tag=event.target.tagName;if(tag=='INPUT'||tag=='TEXTAREA'){return;} var code=event.type=='keydown'?event.keyCode:(event.button==2?ig.KEY.MOUSE2:ig.KEY.MOUSE1);if(event.type=='touchstart'||event.type=='mousedown'){this.mousemove(event);} var action=this.bindings[code];if(action){this.actions[action]=true;if(!this.locks[action]){this.presses[action]=true;this.locks[action]=true;} event.stopPropagation();event.preventDefault();}},keyup:function(event){var tag=event.target.tagName;if(tag=='INPUT'||tag=='TEXTAREA'){return;} var code=event.type=='keyup'?event.keyCode:(event.button==2?ig.KEY.MOUSE2:ig.KEY.MOUSE1);var action=this.bindings[code];if(action){this.delayedKeyup[action]=true;event.stopPropagation();event.preventDefault();}},devicemotion:function(event){this.accel=event.accelerationIncludingGravity;},bind:function(key,action){if(key<0){this.initMouse();} else if(key>0){this.initKeyboard();} this.bindings[key]=action;},bindTouch:function(selector,action){var element=ig.$(selector);var that=this;element.addEventListener('touchstart',function(ev){that.touchStart(ev,action);},false);element.addEventListener('touchend',function(ev){that.touchEnd(ev,action);},false);element.addEventListener('MSPointerDown',function(ev){that.touchStart(ev,action);},false);element.addEventListener('MSPointerUp',function(ev){that.touchEnd(ev,action);},false);},unbind:function(key){var action=this.bindings[key];this.delayedKeyup[action]=true;this.bindings[key]=null;},unbindAll:function(){this.bindings={};this.actions={};this.presses={};this.locks={};this.delayedKeyup={};},state:function(action){return this.actions[action];},pressed:function(action){return this.presses[action];},released:function(action){return!!this.delayedKeyup[action];},clearPressed:function(){for(var action in this.delayedKeyup){this.actions[action]=false;this.locks[action]=false;} this.delayedKeyup={};this.presses={};},touchStart:function(event,action){this.actions[action]=true;this.presses[action]=true;event.stopPropagation();event.preventDefault();return false;},touchEnd:function(event,action){this.delayedKeyup[action]=true;event.stopPropagation();event.preventDefault();return false;}});}); // lib/impact/impact.js ig.baked=true;ig.module('impact.impact').requires('dom.ready','impact.loader','impact.system','impact.input','impact.sound').defines(function(){"use strict";ig.main=function(canvasId,gameClass,fps,width,height,scale,loaderClass){ig.system=new ig.System(canvasId,fps,width,height,scale||1);ig.input=new ig.Input();ig.soundManager=new ig.SoundManager();ig.music=new ig.Music();ig.ready=true;var loader=new(loaderClass||ig.Loader)(gameClass,ig.resources);loader.load();};}); // lib/game/language.js ig.baked=true;ig.module('game.language').defines(function(){var __LANG_ENGLISH_=0;var __LANG_FRENCH_=1;var __LANG_ITALIAN_=2;var __LANG_GERMAN_=3;var __LANG_SPANISH_=4;_CURRENT_LANG_=__LANG_ENGLISH_;_TEXT_=[{"drPusSaysInfection":"\n\nInfection!","drPusSaysScored":"\n\nScored:\n","drPusSaysLevelUp":"\n\nLevel Up!","portraitStartInfection":"\n\nStart\nInfection!","landscapeStartInfection":"Start Infection!","showGameOverCaption":"\n\n Game\n Over","showLevelUpCaption":"Level Up!","portraitForcedInfection":"\n\nForced\nInfection!","landscapeForcedInfection":"Forced Infection!","labelQuitGame":"QUIT GAME","labelRestart":"RESTART","labelSound":"SOUND","labelStartGame":"START GAME","labelLeaderboard":"LEADERBOARD","labelGoals":"GOALS","labelOptions":"OPTIONS","labelOnline":"ONLINE","labelMusic":"MUSIC","labelDifficulty":"DIFFICULTY","labelEasy":"EASY","labelNormal":"NORMAL","labelHard":"HARD","labelVolume":"VOLUME","labelOn":"ON","labelOff":"OFF","labelLogin":"LOGIN","labelLogout":"LOGOUT","labelNext":"NEXT","labelSkip":"SKIP","labelScore":"SCORE: ","labelLevel":"LEVEL: ","labelTime":"TIME: ","labelPost":"SHARE:","labelYes":"YES","labelNo":"NO","skipTutorial":"Do you want to skip all tutorials?","helpPage1":"\n\nGermies is a game, where you need\nto clear germs from the board!\nThis can be done by arranging them\ninto squares or rectangles.\n","helpPage2":"\n\nTo move the germies,\nyou select the one you want,\nand where you want to move it.\nIf another germ is already there,\nthey will swap.","helpPage3":"\n\nGermies slowly start to rot away.\nOnce they have become completely\ndiseased, they can only be removed\nby encasing within a frame.","helpPage4":"\n\nOnce germies are diseased,\nthey will infect adjacent germies;\nwhich become diseased quicker.\nHowever, more points are\nscored for rotting germies!","helpPage5":"\n\nEach time the thermometer\nreaches the top,\na new infection begins.\nYou can force an infection\nby selecting the thermometer!","helpPage6":"\n\nThe game ends when both of the\nincubation areas on the side\nbecome full of germies.\nHow much can you clear?\nCompete on the leaderboards!","tutorialPage1_1":"Match similar shapes into squares\nto clear them from the grid!","tutorialPage1_2":"Click on the thermometer\nto force an infection!","tutorialPage1_3":"Be careful with the incubation\nzones. If they fill up,\nit's Game Over!","tutorialPage2_1":"Did you know, larger areas of\ngerms means more points?","tutorialPage2_2":"Try arranging your germs in a\nlarge square or rectangle frame!","tutorialPage2_3":"You get bonus points for germs\ncaught in the middle!","tutorialPage3_1":"Did you know, the more infected\nthe germ is, the more it's worth?","tutorialPage3_2":"Be careful though!\nDiseased germs are\nharder to remove!","tutorialPage4_1":"Oh No! A diseased germ!\nDon't panic though...\nwe can still clear them!","tutorialPage4_2":"Surround them in a frame of\nsimilar shaped germs...","tutorialPage4_3":"And the diseased germ will also\nclear; and with a nice bonus too!","tutorialPage5_1":"Did you know, some germs are\nworth more than others?","tutorialPage5_2":"Yellow circle germs are worth\nthe least, while pink hexagon\ngerms are the most!","tutorialPage5_3":"If in doubt, count the sides!\nThat will tell you\nhow much they are worth!"}]}); // lib/impact/animation.js ig.baked=true;ig.module('impact.animation').requires('impact.timer','impact.image').defines(function(){"use strict";ig.AnimationSheet=ig.Class.extend({width:8,height:8,image:null,init:function(path,width,height){this.width=width;this.height=height;this.image=new ig.Image(path);}});ig.Animation=ig.Class.extend({sheet:null,timer:null,sequence:[],flip:{x:false,y:false},pivot:{x:0,y:0},frame:0,tile:0,loopCount:0,alpha:1,angle:0,init:function(sheet,frameTime,sequence,stop){this.sheet=sheet;this.pivot={x:sheet.width/2,y:sheet.height/2};this.timer=new ig.Timer();this.frameTime=frameTime;this.sequence=sequence;this.stop=!!stop;this.tile=this.sequence[0];},rewind:function(){this.timer.set();this.loopCount=0;this.frame=0;this.tile=this.sequence[0];return this;},gotoFrame:function(f){this.timer.set(this.frameTime*-f-0.0001);this.update();},gotoRandomFrame:function(){this.gotoFrame(Math.floor(Math.random()*this.sequence.length))},update:function(){var frameTotal=Math.floor(this.timer.delta()/this.frameTime);this.loopCount=Math.floor(frameTotal/this.sequence.length);if(this.stop&&this.loopCount>0){this.frame=this.sequence.length-1;} else{this.frame=frameTotal%this.sequence.length;} this.tile=this.sequence[this.frame];},draw:function(targetX,targetY){var bbsize=Math.max(this.sheet.width,this.sheet.height);if(targetX>ig.system.width||targetY>ig.system.height||targetX+bbsize<0||targetY+bbsize<0){return;} if(this.alpha!=1){ig.system.context.globalAlpha=this.alpha;} if(this.angle==0){this.sheet.image.drawTile(targetX,targetY,this.tile,this.sheet.width,this.sheet.height,this.flip.x,this.flip.y);} else{ig.system.context.save();ig.system.context.translate(ig.system.getDrawPos(targetX+this.pivot.x),ig.system.getDrawPos(targetY+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();} if(this.alpha!=1){ig.system.context.globalAlpha=1;}}});}); // lib/impact/entity.js ig.baked=true;ig.module('impact.entity').requires('impact.animation','impact.impact').defines(function(){"use strict";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:false,bounciness:0,minBounceVelocity:40,anims:{},animSheet:null,currentAnim:null,health:10,type:0,checkAgainst:0,collides:0,_killed:false,slopeStanding:{min:(44).toRad(),max:(136).toRad()},init:function(x,y,settings){this.id=++ig.Entity._lastId;this.pos.x=this.last.x=x;this.pos.y=this.last.y=y;ig.merge(this,settings);},reset:function(x,y,settings){var proto=this.constructor.prototype;this.pos.x=x;this.pos.y=y;this.last.x=x;this.last.y=y;this.vel.x=proto.vel.x;this.vel.y=proto.vel.y;this.accel.x=proto.accel.x;this.accel.y=proto.accel.y;this.health=proto.health;this._killed=proto._killed;this.standing=proto.standing;this.type=proto.type;this.checkAgainst=proto.checkAgainst;this.collides=proto.collides;ig.merge(this,settings);},addAnim:function(name,frameTime,sequence,stop){if(!this.animSheet){throw('No animSheet to add the animation '+name+' to.');} var a=new ig.Animation(this.animSheet,frameTime,sequence,stop);this.anims[name]=a;if(!this.currentAnim){this.currentAnim=a;} return a;},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 mx=this.vel.x*ig.system.tick;var my=this.vel.y*ig.system.tick;var res=ig.game.collisionMap.trace(this.pos.x,this.pos.y,mx,my,this.size.x,this.size.y);this.handleMovementTrace(res);if(this.currentAnim){this.currentAnim.update();}},getNewVelocity:function(vel,accel,friction,max){if(accel){return(vel+accel*ig.system.tick).limit(-max,max);} else if(friction){var delta=friction*ig.system.tick;if(vel-delta>0){return vel-delta;} else if(vel+delta<0){return vel+delta;} else{return 0;}} return vel.limit(-max,max);},handleMovementTrace:function(res){this.standing=false;if(res.collision.y){if(this.bounciness>0&&Math.abs(this.vel.y)>this.minBounceVelocity){this.vel.y*=-this.bounciness;} else{if(this.vel.y>0){this.standing=true;} this.vel.y=0;}} if(res.collision.x){if(this.bounciness>0&&Math.abs(this.vel.x)>this.minBounceVelocity){this.vel.x*=-this.bounciness;} else{this.vel.x=0;}} if(res.collision.slope){var s=res.collision.slope;if(this.bounciness>0){var proj=this.vel.x*s.nx+this.vel.y*s.ny;this.vel.x=(this.vel.x-s.nx*proj*2)*this.bounciness;this.vel.y=(this.vel.y-s.ny*proj*2)*this.bounciness;} else{var lengthSquared=s.x*s.x+s.y*s.y;var dot=(this.vel.x*s.x+this.vel.y*s.y)/lengthSquared;this.vel.x=s.x*dot;this.vel.y=s.y*dot;var angle=Math.atan2(s.x,s.y);if(angle>this.slopeStanding.min&&angle=other.pos.x+other.size.x||this.pos.x+this.size.x<=other.pos.x||this.pos.y>=other.pos.y+other.size.y||this.pos.y+this.size.y<=other.pos.y);},distanceTo:function(other){var xd=(this.pos.x+this.size.x/2)-(other.pos.x+other.size.x/2);var yd=(this.pos.y+this.size.y/2)-(other.pos.y+other.size.y/2);return Math.sqrt(xd*xd+yd*yd);},angleTo:function(other){return Math.atan2((other.pos.y+other.size.y/2)-(this.pos.y+this.size.y/2),(other.pos.x+other.size.x/2)-(this.pos.x+this.size.x/2));},check:function(other){},collideWith:function(other,axis){},ready:function(){},erase: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){if(a.checkAgainst&b.type){a.check(b);} if(b.checkAgainst&a.type){b.check(a);} if(a.collides&&b.collides&&a.collides+b.collides>ig.Entity.COLLIDES.ACTIVE){ig.Entity.solveCollision(a,b);}};ig.Entity.solveCollision=function(a,b){var weak=null;if(a.collides==ig.Entity.COLLIDES.LITE||b.collides==ig.Entity.COLLIDES.FIXED){weak=a;} else if(b.collides==ig.Entity.COLLIDES.LITE||a.collides==ig.Entity.COLLIDES.FIXED){weak=b;} if(a.last.x+a.size.x>b.last.x&&a.last.xb.last.y&&a.last.y0)){var resTop=ig.game.collisionMap.trace(top.pos.x,top.pos.y,0,-(top.pos.y+top.size.y-bottom.pos.y),top.size.x,top.size.y);top.pos.y=resTop.pos.y;if(top.bounciness>0&&top.vel.y>top.minBounceVelocity){top.vel.y*=-top.bounciness;} else{top.standing=true;top.vel.y=0;}} else{var v2=(top.vel.y-bottom.vel.y)/2;top.vel.y=-v2;bottom.vel.y=v2;var nudgeX=bottom.vel.x*ig.system.tick;var resTop=ig.game.collisionMap.trace(top.pos.x,top.pos.y,nudgeX,-nudge/2,top.size.x,top.size.y);top.pos.y=resTop.pos.y;var resBottom=ig.game.collisionMap.trace(bottom.pos.x,bottom.pos.y,0,nudge/2,bottom.size.x,bottom.size.y);bottom.pos.y=resBottom.pos.y;}};}); // lib/impact/map.js ig.baked=true;ig.module('impact.map').defines(function(){"use strict";ig.Map=ig.Class.extend({tilesize:8,width:1,height:1,data:[[]],name:null,init:function(tilesize,data){this.tilesize=tilesize;this.data=data;this.height=data.length;this.width=data[0].length;this.pxWidth=this.width*this.tilesize;this.pxHeight=this.height*this.tilesize;},getTile:function(x,y){var tx=Math.floor(x/this.tilesize);var ty=Math.floor(y/this.tilesize);if((tx>=0&&tx=0&&ty=0&&tx=0&&tythis.lastSlope){this.lastSlope=t|0;}}},trace:function(x,y,vx,vy,objectWidth,objectHeight){var res={collision:{x:false,y:false,slope:false},pos:{x:x,y:y},tile:{x:0,y:0}};var steps=Math.ceil(Math.max(Math.abs(vx),Math.abs(vy))/this.tilesize);if(steps>1){var sx=vx/steps;var sy=vy/steps;for(var i=0;i0?width:0);var tileOffsetX=(vx<0?this.tilesize:0);var firstTileY=Math.max(Math.floor(y/this.tilesize),0);var lastTileY=Math.min(Math.ceil((y+height)/this.tilesize),this.height);var tileX=Math.floor((res.pos.x+pxOffsetX)/this.tilesize);var prevTileX=Math.floor((x+pxOffsetX)/this.tilesize);if(step>0||tileX==prevTileX||prevTileX<0||prevTileX>=this.width){prevTileX=-1;} if(tileX>=0&&tileX1&&t<=this.lastSlope&&this._checkTileDef(res,t,x,y,rvx,rvy,width,height,prevTileX,tileY)){break;}} t=this.data[tileY][tileX];if(t==1||t>this.lastSlope||(t>1&&this._checkTileDef(res,t,x,y,rvx,rvy,width,height,tileX,tileY))){if(t>1&&t<=this.lastSlope&&res.collision.slope){break;} res.collision.x=true;res.tile.x=t;x=res.pos.x=tileX*this.tilesize-pxOffsetX+tileOffsetX;rvx=0;break;}}}} if(vy){var pxOffsetY=(vy>0?height:0);var tileOffsetY=(vy<0?this.tilesize:0);var firstTileX=Math.max(Math.floor(res.pos.x/this.tilesize),0);var lastTileX=Math.min(Math.ceil((res.pos.x+width)/this.tilesize),this.width);var tileY=Math.floor((res.pos.y+pxOffsetY)/this.tilesize);var prevTileY=Math.floor((y+pxOffsetY)/this.tilesize);if(step>0||tileY==prevTileY||prevTileY<0||prevTileY>=this.height){prevTileY=-1;} if(tileY>=0&&tileY1&&t<=this.lastSlope&&this._checkTileDef(res,t,x,y,rvx,rvy,width,height,tileX,prevTileY)){break;}} t=this.data[tileY][tileX];if(t==1||t>this.lastSlope||(t>1&&this._checkTileDef(res,t,x,y,rvx,rvy,width,height,tileX,tileY))){if(t>1&&t<=this.lastSlope&&res.collision.slope){break;} res.collision.y=true;res.tile.y=t;res.pos.y=tileY*this.tilesize-pxOffsetY+tileOffsetY;break;}}}}},_checkTileDef:function(res,t,x,y,vx,vy,width,height,tileX,tileY){var def=this.tiledef[t];if(!def){return false;} var lx=(tileX+def[0])*this.tilesize,ly=(tileY+def[1])*this.tilesize,lvx=(def[2]-def[0])*this.tilesize,lvy=(def[3]-def[1])*this.tilesize,solid=def[4];var tx=x+vx+(lvy<0?width:0)-lx,ty=y+vy+(lvx>0?height:0)-ly;if(lvx*ty-lvy*tx>0){if(vx*-lvy+vy*lvx<0){return solid;} var length=Math.sqrt(lvx*lvx+lvy*lvy);var nx=lvy/length,ny=-lvx/length;var proj=tx*nx+ty*ny;var px=nx*proj,py=ny*proj;if(px*px+py*py>=vx*vx+vy*vy){return solid||(lvx*(ty-vy)-lvy*(tx-vx)<0.5);} res.pos.x=x+vx-px;res.pos.y=y+vy-py;res.collision.slope={x:lvx,y:lvy,nx:nx,ny:ny};return true;} return false;}});var H=1/2,N=1/3,M=2/3,SOLID=true,NON_SOLID=false;ig.CollisionMap.defaultTileDef={5:[0,1,1,M,SOLID],6:[0,M,1,N,SOLID],7:[0,N,1,0,SOLID],3:[0,1,1,H,SOLID],4:[0,H,1,0,SOLID],2:[0,1,1,0,SOLID],10:[H,1,1,0,SOLID],21:[0,1,H,0,SOLID],32:[M,1,1,0,SOLID],43:[N,1,M,0,SOLID],54:[0,1,N,0,SOLID],27:[0,0,1,N,SOLID],28:[0,N,1,M,SOLID],29:[0,M,1,1,SOLID],25:[0,0,1,H,SOLID],26:[0,H,1,1,SOLID],24:[0,0,1,1,SOLID],11:[0,0,H,1,SOLID],22:[H,0,1,1,SOLID],33:[0,0,N,1,SOLID],44:[N,0,M,1,SOLID],55:[M,0,1,1,SOLID],16:[1,N,0,0,SOLID],17:[1,M,0,N,SOLID],18:[1,1,0,M,SOLID],14:[1,H,0,0,SOLID],15:[1,1,0,H,SOLID],13:[1,1,0,0,SOLID],8:[H,1,0,0,SOLID],19:[1,1,H,0,SOLID],30:[N,1,0,0,SOLID],41:[M,1,N,0,SOLID],52:[1,1,M,0,SOLID],38:[1,M,0,1,SOLID],39:[1,N,0,M,SOLID],40:[1,0,0,N,SOLID],36:[1,H,0,1,SOLID],37:[1,0,0,H,SOLID],35:[1,0,0,1,SOLID],9:[1,0,H,1,SOLID],20:[H,0,0,1,SOLID],31:[1,0,M,1,SOLID],42:[M,0,N,1,SOLID],53:[N,0,0,1,SOLID],12:[0,0,1,0,NON_SOLID],23:[1,1,0,1,NON_SOLID],34:[1,0,1,1,NON_SOLID],45:[0,1,0,0,NON_SOLID]};ig.CollisionMap.staticNoCollision={trace:function(x,y,vx,vy){return{collision:{x:false,y:false,slope:false},pos:{x:x+vx,y:y+vy},tile:{x:0,y:0}};}};}); // lib/impact/background-map.js ig.baked=true;ig.module('impact.background-map').requires('impact.map','impact.image').defines(function(){"use strict";ig.BackgroundMap=ig.Map.extend({tiles:null,scroll:{x:0,y:0},distance:1,repeat:false,tilesetName:'',foreground:false,enabled:true,preRender:false,preRenderedChunks:null,chunkSize:512,debugChunks:false,anims:{},init:function(tilesize,data,tileset){this.parent(tilesize,data);this.setTileset(tileset);},setTileset:function(tileset){this.tilesetName=tileset instanceof ig.Image?tileset.path:tileset;this.tiles=new ig.Image(this.tilesetName);this.preRenderedChunks=null;},setScreenPos:function(x,y){this.scroll.x=x/this.distance;this.scroll.y=y/this.distance;},preRenderMapToChunks:function(){var totalWidth=this.width*this.tilesize*ig.system.scale,totalHeight=this.height*this.tilesize*ig.system.scale;this.chunkSize=Math.min(Math.max(totalWidth,totalHeight),this.chunkSize);var chunkCols=Math.ceil(totalWidth/this.chunkSize),chunkRows=Math.ceil(totalHeight/this.chunkSize);this.preRenderedChunks=[];for(var y=0;y=this.height||tileY<0){if(!this.repeat){continue;} tileY=(tileY%this.height+this.height)%this.height;} for(var mapX=-1,pxX=pxMinX;pxX=this.width||tileX<0){if(!this.repeat){continue;} tileX=(tileX%this.width+this.width)%this.width;} if((tile=this.data[tileY][tileX])){if((anim=this.anims[tile-1])){anim.draw(pxX,pxY);} else{this.tiles.drawTile(pxX,pxY,tile-1,this.tilesize);}}}}}});}); // lib/impact/game.js ig.baked=true;ig.module('impact.game').requires('impact.impact','impact.entity','impact.collision-map','impact.background-map').defines(function(){"use strict";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:false,sortBy:null,cellSize:64,_deferredKill:[],_levelToLoad:null,_doSortEntities:false,staticInstantiate:function(){this.sortBy=this.sortBy||ig.Game.SORT.Z_INDEX;ig.game=this;return null;},loadLevel:function(data){this.screen={x:0,y:0};this.entities=[];this.namedEntities={};for(var i=0;i(a*=2)?0.5*a*a*((this._p2+1)*a-this._p2):0.5*((a-=2)*a*((this._p2+1)*a+this._p2)+2)}),p=b("BounceOut",function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375}),q=b("BounceIn",function(a){return(a=1-a)<1/2.75?1-7.5625*a*a:a<2/2.75?1-(7.5625*(a-=1.5/2.75)*a+0.75):a<2.5/2.75?1-(7.5625*(a-=2.25/2.75)*a+0.9375):1-(7.5625*(a-=2.625/2.75)*a+0.984375)}),r=b("BounceInOut",function(a){var b=0.5>a,a=b?1-2*a:2*a-1,a=a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375;return b?0.5*(1-a):0.5*a+0.5}),s=b("CircOut",function(a){return Math.sqrt(1-(a-=1)*a)}),t=b("CircIn",function(a){return-(Math.sqrt(1-a*a)-1)}),u=b("CircInOut",function(a){return 1>(a*=2)?-0.5*(Math.sqrt(1-a*a)-1):0.5*(Math.sqrt(1-(a-=2)*a)+1)}),i=2*Math.PI,j=function(a,b,e){var d=c("easing."+a,function(a,b){this._p1=a||1;this._p2=b||e;this._p3=this._p2/i*(Math.asin(1/this._p1)||0)},!0),a=d.prototype=new g;a.constructor=d;a.getRatio=b;a.config=function(a,b){return new d(a,b)};return d},v=j("ElasticOut",function(a){return this._p1*Math.pow(2,-10*a)*Math.sin((a-this._p3)*i/this._p2)+1},0.3),w=j("ElasticIn",function(a){return-(this._p1*Math.pow(2,10*(a-=1))*Math.sin((a-this._p3)*i/this._p2))},0.3),j=j("ElasticInOut",function(a){return 1>(a*=2)?-0.5*this._p1*Math.pow(2,10*(a-=1))*Math.sin((a-this._p3)*i/this._p2):0.5*this._p1*Math.pow(2,-10*(a-=1))*Math.sin((a-this._p3)*i/this._p2)+1},0.45),x=b("ExpoOut",function(a){return 1-Math.pow(2,-10*a)}),y=b("ExpoIn",function(a){return Math.pow(2,10*(a-1))-0.001}),z=b("ExpoInOut",function(a){return 1>(a*=2)?0.5*Math.pow(2,10*(a-1)):0.5*(2-Math.pow(2,-10*(a-1)))}),m=Math.PI/2,A=b("SineOut",function(a){return Math.sin(a*m)}),B=b("SineIn",function(a){return-Math.cos(a*m)+1}),b=b("SineInOut",function(a){return-0.5*(Math.cos(Math.PI*a)-1)}),f=c("easing.SlowMo",function(a,b,c){null==a?a=0.7:1this._p3?this._calcEnd?1-(a=(a-this._p3)/this._p1)*a:b+(a-b)*(a=(a-this._p3)/this._p1)*a*a*a:this._calcEnd?1:b};f.ease=new f(0.7,0.7);e.config=f.config=function(a,b,c){return new f(a,b,c)};var k=c("easing.SteppedEase",function(a){a=a||1;this._p1=1/a;this._p2=a+1},!0),e=k.prototype=new g;e.constructor=k;e.getRatio=function(a){0>a?a=0:1<=a&&(a=0.999999999);return(this._p2*a>>0)*this._p1};e.config=k.config=function(a){return new k(a)};c("easing.Bounce",{easeOut:new p,easeIn:new q,easeInOut:new r},!0);c("easing.Circ",{easeOut:new s,easeIn:new t,easeInOut:new u},!0);c("easing.Elastic",{easeOut:new v,easeIn:new w,easeInOut:new j},!0);c("easing.Expo",{easeOut:new x,easeIn:new y,easeInOut:new z},!0);c("easing.Sine",{easeOut:new A,easeIn:new B,easeInOut:new b},!0);return{easeOut:new n,easeIn:new o,easeInOut:new h}},!0)});window._gsDefine&&_gsQueue.pop()();}) // lib/plugins/tween-lite.js ig.baked=true;ig.module('plugins.tween-lite').requires('plugins.ease-pack').defines(function(){(function(n){var H=function(a){a=a.split(".");var c=n,b;for(b=0;ba?2*a:2*(1-a);1===b?l*=l:2===b?l*=l*l:3===b?l*=l*l*l:4===b&&(l*=l*l*l*l);return 1===c?1-l:2===c?l:0.5>a?l/2:1-l/2};q=["Linear","Quad","Cubic","Quart","Quint"];for(k=q.length;-1<--k;)d=s("easing."+q[k],null,!0),C=s("easing.Power"+k,null,!0),d.easeOut=C.easeOut=new u(null,null,1,k),d.easeIn=C.easeIn=new u(null,null,2,k),d.easeInOut=C.easeInOut=new u(null,null,3,k);s("easing.Strong",m.easing.Power4,!0);m.easing.Linear.easeNone=m.easing.Linear.easeIn;var K=s("events.EventDispatcher",function(a){this._listeners={};this._eventTarget=a||this});d=K.prototype;d.addEventListener=function(a,c,b,l,e){e=e||0;var d=this._listeners[a],j=0,f;null==d&&(this._listeners[a]=d=[]);for(f=d.length;-1<--f;)a=d[f],a.c===c?d.splice(f,1):0===j&&a.pr=p||!0===a)b.frame++,p=b.time>p?b.time+h-(b.time-p):b.time+h-0.001,p>0||1)}:z;k();f=j(m)};this.useRAF=function(a){if(!arguments.length)return d;k();d=a;b.fps(g)};b.fps(a);n.setTimeout(function(){d&&!f&&b.useRAF(!1)},1E3)});d=m.Ticker.prototype=new m.events.EventDispatcher;d.constructor=m.Ticker;var r=s("core.Animation",function(a,c){this.vars=c||{};this._duration=this._totalDuration=a||0;this._delay=Number(this.vars.delay)||0;this._timeScale=1;this._active=!0===this.vars.immediateRender;this.data=this.vars.data;this._reversed=!0===this.vars.reversed;if(v){I||(t.tick(),I=!0);var b=this.vars.useFrames?y:v;b.insert(this,b._time);this.vars.paused&&this.paused(!0)}}),t=r.ticker=new m.Ticker;d=r.prototype;d._dirty=d._gc=d._initted=d._paused=!1;d._totalTime=d._time=0;d._rawPrevTime=-1;d._next=d._last=d._onUpdate=d._timeline=d.timeline=null;d._paused=!1;d.play=function(a,c){arguments.length&&this.seek(a,c);this.reversed(!1);return this.paused(!1)};d.pause=function(a,c){arguments.length&&this.seek(a,c);return this.paused(!0)};d.resume=function(a,c){arguments.length&&this.seek(a,c);return this.paused(!1)};d.seek=function(a,c){return this.totalTime(Number(a),!1!==c)};d.restart=function(a,c){this.reversed(!1);this.paused(!1);return this.totalTime(a?-this._delay:0,!1!==c)};d.reverse=function(a,c){arguments.length&&this.seek(a||this.totalDuration(),c);this.reversed(!0);return this.paused(!1)};d.render=function(){};d.invalidate=function(){return this};d._enabled=function(a,c){this._gc=!a;this._active=a&&!this._paused&&0this._duration&&(a=this._duration);return this.totalTime(a,c)};d.totalTime=function(a,c){if(!arguments.length)return this._totalTime;if(this._timeline){0>a&&(a+=this.totalDuration());if(this._timeline.smoothChildTiming&&(this._dirty&&this.totalDuration(),a>this._totalDuration&&(a=this._totalDuration),this._startTime=(this._paused?this._pauseTime:this._timeline._time)-(!this._reversed?a:this._totalDuration-a)/this._timeScale,this._timeline._dirty||this._uncache(!1),!this._timeline._active))for(var b=this._timeline;b._timeline;)b.totalTime(b._totalTime,!0),b=b._timeline;this._gc&&this._enabled(!0,!1);this._totalTime!==a&&this.render(a,c,!1)} return this};d.startTime=function(a){if(!arguments.length)return this._startTime;a!==this._startTime&&(this._startTime=a,this.timeline&&this.timeline._sortChildren&&this.timeline.insert(this,a-this._delay));return this};d.timeScale=function(a){if(!arguments.length)return this._timeScale;a=a||1E-6;if(this._timeline&&this._timeline.smoothChildTiming){var c=this._pauseTime||0===this._pauseTime?this._pauseTime:this._timeline._totalTime;this._startTime=c-(c- this._startTime)*this._timeScale/a} this._timeScale=a;return this._uncache(!1)};d.reversed=function(a){if(!arguments.length)return this._reversed;a!=this._reversed&&(this._reversed=a,this.totalTime(this._totalTime,!0));return this};d.paused=function(a){if(!arguments.length)return this._paused;a!=this._paused&&this._timeline&&(!a&&this._timeline.smoothChildTiming&&(this._startTime+=this._timeline.rawTime()-this._pauseTime,this._uncache(!1)),this._pauseTime=a?this._timeline.rawTime():null,this._paused=a,this._active=!this._paused&&0d;)b=b._prev;b?(a._next=b._next,b._next=a):(a._next=this._first,this._first=a);a._next?a._next._prev=a:this._last=a;a._prev=b;this._timeline&&this._uncache(!0);return this};d._remove=function(a,c){a.timeline===this&&(c||a._enabled(!1,!0),a.timeline=null,a._prev?a._prev._next=a._next:this._first===a&&(this._first=a._next),a._next?a._next._prev=a._prev:this._last===a&&(this._last=a._prev),this._timeline&&this._uncache(!0));return this};d.render=function(a,c){var b=this._first,d;for(this._totalTime=this._time=this._rawPrevTime=a;b;){d=b._next;if(b._active||a>=b._startTime&&!b._paused)b._reversed?b.render((!b._dirty?b._totalDuration:b.totalDuration())-(a-b._startTime)*b._timeScale,c,!1):b.render((a-b._startTime)*b._timeScale,c,!1);b=d}};d.rawTime=function(){return this._totalTime};var h=s("TweenLite",function(a,c,b){r.call(this,c,b);if(null==a)throw"Cannot tween an undefined reference.";this.target=a;this._overwrite=null==this.vars.overwrite?M[h.defaultOverwrite]:"number"===typeof this.vars.overwrite?this.vars.overwrite>>0:M[this.vars.overwrite];if((a instanceof Array||a.jquery)&&"object"===typeof a[0]){this._targets=a.slice(0);this._propLookup=[];this._siblings=[];for(a=0;ah&&((m||!f._initted)&&2E-10>=h-f._startTime||(p[k++]=f));for(g=k;-1<--g;)if(f=p[g],2===d&&f._kill(b,a)&&(j=!0),2!==d||!f._firstPT&&f._initted)f._enabled(!1,!1)&&(j=!0);return j},O=function(a,c,b){for(var d=a._timeline,e=d._timeScale,g=a._startTime;d._timeline;){g+=d._startTime;e*=d._timeScale;if(d._paused)return-100;d=d._timeline} g/=e;return g>c?g-c:b&&g===c||!a._initted&&2E-10>g-c?1E-10:(g+=a.totalDuration()/a._timeScale/e)>c?0:g-c-1E-10};d._init=function(){this.vars.startAt&&(this.vars.startAt.overwrite=0,this.vars.startAt.immediateRender=!0,h.to(this.target,0,this.vars.startAt));var a,c;this._ease=this.vars.ease instanceof u?this.vars.easeParams instanceof Array?this.vars.ease.config.apply(this.vars.ease,this.vars.easeParams):this.vars.ease:"function"===typeof this.vars.ease?new u(this.vars.ease,this.vars.easeParams):h.defaultEase;this._easeType=this._ease._type;this._easePower=this._ease._power;this._firstPT=null;if(this._targets)for(a=this._targets.length;-1<--a;){if(this._initProps(this._targets[a],this._propLookup[a]={},this._siblings[a],this._overwrittenProps?this._overwrittenProps[a]:null))c=!0}else c=this._initProps(this.target,this._propLookup,this._siblings,this._overwrittenProps);c&&h._onPluginEvent("_onInitAllProps",this);this._overwrittenProps&&null==this._firstPT&&"function"!==typeof this.target&&this._enabled(!1,!1);if(this.vars.runBackwards)for(a=this._firstPT;a;)a.s+=a.c,a.c=-a.c,a=a._next;this._onUpdate=this.vars.onUpdate;this._initted=!0};d._initProps=function(a,c,b,d){var e,g,j,f,h,k;if(null==a)return!1;for(e in this.vars){if(Q[e]){if("onStartParams"===e||"onUpdateParams"===e||"onCompleteParams"===e||"onReverseCompleteParams"===e||"onRepeatParams"===e)if(h=this.vars[e])for(g=h.length;-1<--g;)"{self}"===h[g]&&(h=this.vars[e]=h.concat(),h[g]=this)}else if(N[e]&&(f=new N[e])._onInitTween(a,this.vars[e],this)){this._firstPT=k={_next:this._firstPT,t:f,p:"setRatio",s:0,c:1,f:!0,n:e,pg:!0,pr:f._priority};for(g=f._overwriteProps.length;-1<--g;)c[f._overwriteProps[g]]=this._firstPT;if(f._priority||f._onInitAllProps)j=!0;if(f._onDisable||f._onEnable)this._notifyPluginsOfEnabled=!0}else this._firstPT=c[e]=k={_next:this._firstPT,t:a,p:e,f:"function"===typeof a[e],n:e,pg:!1,pr:0},k.s=!k.f?parseFloat(a[e]):a[e.indexOf("set")||"function"!==typeof a["get"+e.substr(3)]?e:"get"+e.substr(3)](),g=this.vars[e],k.c="number"===typeof g?g-k.s:"string"===typeof g&&"="===g.charAt(1)?parseInt(g.charAt(0)+"1",10)*Number(g.substr(2)):Number(g)||0;k&&k._next&&(k._next._prev=k)} return d&&this._kill(d,a)?this._initProps(a,c,b,d):1=this._duration){if(this._totalTime=this._time=this._duration,this.ratio=this._ease._calcEnd?this._ease.getRatio(1):1,this._reversed||(e=!0,g="onComplete"),0===this._duration){if(0===a||0>this._rawPrevTime)this._rawPrevTime!==a&&(b=!0);this._rawPrevTime=a}}else if(0>=a){this._totalTime=this._time=0;this.ratio=this._ease._calcEnd?this._ease.getRatio(0):0;if(0!==d||0===this._duration&&0a?(this._active=!1,0===this._duration&&(0<=this._rawPrevTime&&(b=!0),this._rawPrevTime=a)):this._initted||(b=!0)}else if(this._totalTime=this._time=a,this._easeType){var j=a/this._duration,f=this._easeType,h=this._easePower;if(1===f||3===f&&0.5<=j)j=1-j;3===f&&(j*=2);1===h?j*=j:2===h?j*=j*j:3===h?j*=j*j*j:4===h&&(j*=j*j*j*j);this.ratio=1===f?1-j:2===f?j:0.5>a/this._duration?j/2:1-j/2}else this.ratio=this._ease.getRatio(a/this._duration);if(this._time!==d||b){this._initted||(this._init(),!e&&this._time&&(this.ratio=this._ease.getRatio(this._time/this._duration)));!this._active&&!this._paused&&(this._active=!0);if(0===d&&this.vars.onStart&&(0!==this._time||0===this._duration))c||this.vars.onStart.apply(this.vars.onStartScope||this,this.vars.onStartParams||E);for(a=this._firstPT;a;){if(a.f)a.t[a.p](a.c*this.ratio+a.s);else a.t[a.p]=a.c*this.ratio+a.s;a=a._next} this._onUpdate&&(c||this._onUpdate.apply(this.vars.onUpdateScope||this,this.vars.onUpdateParams||E));g&&!this._gc&&(e&&(this._timeline.autoRemoveChildren&&this._enabled(!1,!1),this._active=!1),c||this.vars[g]&&this.vars[g].apply(this.vars[g+"Scope"]||this,this.vars[g+"Params"]||E))}};d._kill=function(a,c){"all"===a&&(a=null);if(null==a&&(null==c||c===this.target))return this._enabled(!1,!1);c=c||this._targets||this.target;var b,d,e,g,h,f,k;if((c instanceof Array||c.jquery)&&"object"===typeof c[0])for(b=c.length;-1<--b;)this._kill(a,c[b])&&(h=!0);else{if(this._targets)for(b=this._targets.length;-1<--b;){if(c===this._targets[b]){g=this._propLookup[b]||{};this._overwrittenProps=this._overwrittenProps||[];d=this._overwrittenProps[b]=a?this._overwrittenProps[b]||{}:"all";break}}else{if(c!==this.target)return!1;g=this._propLookup;d=this._overwrittenProps=a?this._overwrittenProps||{}:"all"} if(g)for(e in f=a||g,k=a!==d&&"all"!==d&&a!==g&&(null==a||!0!==a._tempKill),f){if(b=g[e]){b.pg&&b.t._kill(f)&&(h=!0);if(!b.pg||0===b.t._overwriteProps.length)b._prev?b._prev._next=b._next:b===this._firstPT&&(this._firstPT=b._next),b._next&&(b._next._prev=b._prev),b._next=b._prev=null;delete g[e]} k&&(d[e]=1)}} return h};d.invalidate=function(){this._notifyPluginsOfEnabled&&h._onPluginEvent("_onDisable",this);this._onUpdate=this._overwrittenProps=this._firstPT=null;this._initted=this._active=this._notifyPluginsOfEnabled=!1;this._propLookup=this._targets?{}:[];return this};d._enabled=function(a,c){if(a&&this._gc)if(this._targets)for(var b=this._targets.length;-1<--b;)this._siblings[b]=A(this._targets[b],this,!0);else this._siblings=A(this.target,this,!0);r.prototype._enabled.call(this,a,c);return this._notifyPluginsOfEnabled&&this._firstPT?h._onPluginEvent(a?"_onEnable":"_onDisable",this):!1};h.to=function(a,c,b){return new h(a,c,b)};h.from=function(a,c,b){b.runBackwards=!0;!1!==b.immediateRender&&(b.immediateRender=!0);return new h(a,c,b)};h.fromTo=function(a,c,b,d){d.startAt=b;b.immediateRender&&(d.immediateRender=!0);return new h(a,c,d)};h.delayedCall=function(a,c,b,d,e){return new h(c,0,{delay:a,onComplete:c,onCompleteParams:b,onCompleteScope:d,onReverseComplete:c,onReverseCompleteParams:b,onReverseCompleteScope:d,immediateRender:!1,useFrames:e,overwrite:0})};h.set=function(a,c){return new h(a,0,c)};h.killTweensOf=h.killDelayedCallsTo=function(a,c){for(var b=h.getTweensOf(a),d=b.length;-1<--d;)b[d]._kill(c,a)};h.getTweensOf=function(a){if(null!=a){var c,b,d;if((a instanceof Array||a.jquery)&&"object"===typeof a[0]){c=a.length;for(b=[];-1<--c;)b=b.concat(h.getTweensOf(a[c]));for(c=b.length;-1<--c;){d=b[c];for(a=c;-1<--a;)d===b[a]&&b.splice(c,1)}}else{b=A(a).concat();for(c=b.length;-1<--c;)b[c]._gc&&b.splice(c,1)} return b}};var B=s("plugins.TweenPlugin",function(a,c){this._overwriteProps=(a||"").split(",");this._propName=this._overwriteProps[0];this._priority=c||0},!0);d=B.prototype;B.version=12;B.API=2;d._firstPT=null;d._addTween=function(a,c,b,d,e,g){var h;if(null!=d&&(h="number"===typeof d||"="!==d.charAt(1)?Number(d)-b:parseInt(d.charAt(0)+"1",10)*Number(d.substr(2))))this._firstPT=a={_next:this._firstPT,t:a,p:c,s:b,c:h,f:"function"===typeof a[c],n:e||c,r:g},a._next&&(a._next._prev=a)};d.setRatio=function(a){for(var c=this._firstPT,b;c;){b=c.c*a+c.s;c.r&&(b=b+(0>0);if(c.f)c.t[c.p](b);else c.t[c.p]=b;c=c._next}};d._kill=function(a){if(null!=a[this._propName])this._overwriteProps=[];else for(var c=this._overwriteProps.length;-1<--c;)null!=a[this._overwriteProps[c]]&&this._overwriteProps.splice(c,1);for(c=this._firstPT;c;)null!=a[c.n]&&(c._next&&(c._next._prev=c._prev),c._prev?(c._prev._next=c._next,c._prev=null):this._firstPT===c&&(this._firstPT=c._next)),c=c._next;return!1};d._roundProps=function(a,c){for(var b=this._firstPT;b;){if(a[this._propName]||null!=b.n&&a[b.n.split(this._propName+"_").join("")])b.r=c;b=b._next}};h._onPluginEvent=function(a,c){var b=c._firstPT,d;if("_onInitAllProps"===a){for(var e,g,h,f;b;){f=b._next;for(e=g;e&&e.pr>b.pr;)e=e._next;(b._prev=e?e._prev:h)?b._prev._next=b:g=b;(b._next=e)?e._prev=b:h=b;b=f} b=c._firstPT=g} for(;b;)b.pg&&"function"===typeof b.t[a]&&b.t[a]()&&(d=!0),b=b._next;return d};B.activate=function(a){for(var c=a.length;-1<--c;)a[c].API===B.API&&(h._plugins[(new a[c])._propName]=a[c]);return!0};if(q=n._gsQueue){for(k=0;k=this.x&&x<=this.right&&y>=this.y&&y<=this.bottom){return true;} return false;}})}) // lib/game/pages/pagemanager.js ig.baked=true;ig.module('game.pages.pagemanager').requires('impact.timer').defines(function(){PageManager=ig.Class.extend({init:function(pages){this.pages=pages;this.hasTimer=false;this.pageCount=pages.length;this.currentPage=0;this.page=pages[0];},setTimer:function(time){this.hasTimer=true;this.timeReset=time;this.timer=new ig.Timer();this.timer.set(time);this.timer.start();},update:function(){if(true==this.hasTimer){if(this.timer.delta()<=0){this.nextPage();this.timer.set(this.timeReset);}} this.page.update();},nextPage:function(){if(this.currentPagethis.pauseButtonDelay){this.paused=override!=null?override:!this.paused;if(!this.paused) this.onResume();else this.onPause();this.pauseDelayTimer.reset();}},onResume:function(){if(this.hideMenu) this.hideMenu();},onPause:function(){if(this.showMenu) this.onShowPauseMenu()},onShowPauseMenu:function(){this.showMenu(new Menu("Pause"));}});ig.Entity.inject({ignorePause:false})}) // lib/bootstrap/plugins/utils.js ig.baked=true;ig.module('bootstrap.plugins.utils').requires('impact.game').defines(function(){ig.utils={};String.prototype.pad=function(l,s){return(l-=this.length)>0?(s=new Array(Math.ceil(l/s.length)+1).join(s)).substr(0,s.length)+this+s.substr(0,l-s.length):this;};String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.slice(1);};ig.utils.randomRange=function(from,to){return Math.floor(Math.random()*(to-from+1)+from);};Array.prototype.shuffle=function(){var i=this.length,j,tempi,tempj;if(i==0)return false;while(--i){j=Math.floor(Math.random()*(i+1));tempi=this[i];tempj=this[j];this[i]=tempj;this[j]=tempi;} return this;} String.prototype.fromatTime=function(){sec_numb=parseInt(this);var hours=Math.floor(sec_numb/3600);var minutes=Math.floor((sec_numb-(hours*3600))/60);var seconds=sec_numb-(hours*3600)-(minutes*60);if(minutes<10){minutes="0"+minutes;} if(seconds<10){seconds="0"+seconds;} var time=minutes+':'+seconds;return time;} ig.Game.inject({currentLevelName:null,loadLevelByFileName:function(value,deferred){this.currentLevelName=value.replace(/^(Level)?(\w)(\w*)/,function(m,l,a,b){return a.toUpperCase()+b;}).replace(".js","");var levelData=ig.global['Level'+this.currentLevelName];this[deferred?"loadLevelDeferred":"loadLevel"](levelData);}})}) // lib/game/levels/000.js ig.baked=true;ig.module('game.levels.000').requires('impact.image').defines(function(){Level000={"entities":[],"layer":[{"name":"grid","width":8,"height":6,"linkWithCollision":false,"visible":1,"tilesetName":"media/sprites/tiles.png","repeat":false,"preRender":true,"distance":"1","tilesize":32,"foreground":true,"data":[[1,2,2,2,2,2,2,1],[1,2,2,2,2,2,2,1],[1,2,2,2,2,2,2,1],[1,2,2,2,2,2,2,1],[1,2,2,2,2,2,2,1],[1,2,2,2,2,2,2,1]]}]};Level000Resources=[new ig.Image('media/sprites/tiles.png')];}); // lib/game/entities/drpus.js ig.baked=true;ig.module('game.entities.drpus').requires('impact.entity','impact.timer').defines(function(){EntityDrPus=ig.Entity.extend({size:{x:96,y:128},animSheet:new ig.AnimationSheet('media/sprites/drpus.png',96,128),speech:new ig.Image('media/sprites/speech.png',96,128),speechTo:new ig.Image('media/sprites/speechto.png',32,32),isSpeaking:true,isSaying:"\n\nGermies !!!",font:new ig.Font("media/fonts/speech.font.png"),init:function(x,y,settings){this.parent(x,y,settings);this.speechTimer=new ig.Timer();this.speechTimer.set(2);this.lookTimer=new ig.Timer();this.lookTimer.set(0);this.addAnim('idle',1,[1]);this.addAnim('sad',1,[3]);this.addAnim('smile',1,[0]);this.addAnim('wink',1,[2]);this.addAnim('shocked',1,[4]);this.defaultAnim=this.anims.idle;},update:function(){this.parent();if(this.speechTimer.delta()>=0){this.speechTimer.pause();this.isSpeaking=false;} if(this.lookTimer.delta()>=0){this.lookTimer.pause();this.currentAnim=this.defaultAnim;}},say:function(what,time){this.speechTimer.set(time);this.isSaying=what;this.isSpeaking=true;},look:function(state){if('idle'==state) this.currentAnim=this.anims.idle;else if('sad'==state) this.currentAnim=this.anims.sad;else if('smile'==state) this.currentAnim=this.anims.smile;else if('wink'==state) this.currentAnim=this.anims.wink;else if('shocked'==state) this.currentAnim=this.anims.shocked;this.lookTimer.set(2);},draw:function(){var myGradient=ig.system.context.createLinearGradient(this.pos.x,this.pos.y+this.size.y-5,this.pos.x+this.size.x,this.pos.y+this.size.y);myGradient.addColorStop(0,'rgba(1,1,1,0)');myGradient.addColorStop(0.5,'rgba(1,1,1,0.5)');myGradient.addColorStop(1,'rgba(1,1,1,0)');ig.system.context.fillStyle=myGradient;ig.system.context.fillRect(this.pos.x,this.pos.y+this.size.y-5,this.pos.x+this.size.x,5);this.parent();if(this.isSpeaking==true){this.speech.draw(this.pos.x-96,this.pos.y);this.speechTo.draw(this.pos.x-2,this.pos.y+24);this.font.draw(this.isSaying,(this.pos.x-93)+(this.font.widthForString(this.isSaying)*0.5),this.pos.y-1,ig.Font.ALIGN.CENTER);}}});}); // lib/game/entities/splat.js ig.baked=true;ig.module('game.entities.splat').requires('impact.entity').defines(function(){EntitySplat=ig.Entity.extend({size:{x:8,y:8},maxVel:{x:160,y:160},lifetime:2,fadetime:1,bounciness:0.6,friction:{x:20,y:0},animSheet:new ig.AnimationSheet('media/sprites/splatparticle.png',8,8),init:function(x,y,settings){this.parent(x,y,settings);this.addAnim('idle',0.125,[0,1,2,3,4,5],true);this.vel.x=(Math.random()*2-1)*this.vel.x;this.vel.y=(Math.random()*2-1)*this.vel.y;this.currentAnim.flip.x=(Math.random()>0.5);this.currentAnim.flip.y=(Math.random()>0.5);this.currentAnim.gotoRandomFrame();this.idleTimer=new ig.Timer();},update:function(){if(this.idleTimer.delta()>this.lifetime){this.kill();return;} this.currentAnim.alpha=this.idleTimer.delta().map(this.lifetime-this.fadetime,this.lifetime,1,0);this.parent();}});}); // lib/game/entities/germ.js ig.baked=true;ig.module('game.entities.germ').requires('impact.entity','impact.timer','game.entities.splat').defines(function(){EntityGerm=ig.Entity.extend({size:{x:32,y:32},health:101,animSheet:new ig.AnimationSheet('media/sprites/germies.png',32,32),selectedImage:new ig.Image('media/sprites/selected.png'),puzzleImage:new ig.Image('media/sprites/puzzle.png'),CIRCLE:1,TRIANGLE:3,SQUARE:4,RHOMBUS:4,PENTAGON:5,HEXAGON:6,DISEASED:-1,shape:0,shapeOffset:8,isPuzzle:true,init:function(x,y,settings){this.parent(x,y,settings);this.addAnim('at100',1,[0+(this.shape*this.shapeOffset)]);this.addAnim('at75',1,[1+(this.shape*this.shapeOffset)]);this.addAnim('at50',1,[2+(this.shape*this.shapeOffset)]);this.addAnim('at25',1,[3+(this.shape*this.shapeOffset)]);this.addAnim('at0',1,[4+(this.shape*this.shapeOffset)]);this.infectionTimer=new ig.Timer();this.infectionTimer.set(MainGameManager.infectionRate);this.isSelected=false;if(typeof(MainGameManager)!='undefined'){this.grid={x:Math.floor((x-MainGameManager.GRID_OFFSET.x)/MainGameManager.GERM_SIZE),y:Math.floor((y-MainGameManager.GRID_OFFSET.y)/MainGameManager.GERM_SIZE)};MainGameManager.grid[this.grid.y][this.grid.x]=this;}},update:function(){this.parent();if(this.infectionTimer.delta()>=0){this.infectionTimer.set(MainGameManager.infectionRate*MainGameManager.difficultyModifier);if(this.health>1) this.receiveDamage(1);else this.shape=this.DISEASED;if(this.shape==this.DISEASED){MainGameManager.spreadDisease(this.grid.x,this.grid.y);this.infectionTimer.set(0.5);}} if(this.health>75) this.currentAnim=this.anims.at100;else if(this.health>50) this.currentAnim=this.anims.at75;else if(this.health>25) this.currentAnim=this.anims.at50;else if(this.health>1) this.currentAnim=this.anims.at25;else{this.currentAnim=this.anims.at0;if((MainGameManager.displayedTutorial4==false)&&(MainGameManager.tutorialEnabled==true)){MainGameManager.displayTutorial('tutorial4');MainGameManager.displayedTutorial4=true;}}},draw:function(){if(this.isPuzzle) this.puzzleImage.draw(this.pos.x,this.pos.y);this.parent();if(this.isSelected) this.selectedImage.draw(this.pos.x+this.shapeOffset,this.pos.y+this.shapeOffset);},kill:function(){for(var i=0;i<5;++i) ig.game.spawnEntity(EntitySplat,this.pos.x+(this.size.x/2),this.pos.y+(this.size.y/2),{vel:{x:(Math.random()*2-1)*75,y:(Math.random()*2-1)*75}});this.parent();}});}); // lib/game/pages/intropage.js ig.baked=true;ig.module('game.pages.intropage').requires('game.pages.page','game.entities.splat').defines(function(){IntroPage=Page.extend({image1:new ig.Image("media/sprites/1.png"),image2:new ig.Image("media/sprites/2.png"),image3:new ig.Image("media/sprites/3.png"),goImage:new ig.Image("media/sprites/go.png"),splatSound:new ig.Sound('media/sounds/squish.mp3'),init:function(screen){this.screen=screen;this.timer=new ig.Timer();this.timer.set(1);this.state=3;this.image=this.image3;this.centre={x:ig.system.width*0.5,y:ig.system.height*0.5};},update:function(){if(0<=this.timer.delta()){this.splatSound.play();--this.state;if(this.state==2) this.image=this.image2;else if(this.state==1) this.image=this.image1;else if(this.state==0) this.image=this.goImage;for(var i=0;i<30;++i) ig.game.spawnEntity(EntitySplat,(this.centre.x-(this.image.width*0.5))+(Math.random()*this.image.width),(this.centre.y-(this.image.height*0.5))+(Math.random()*this.image.height),{vel:{x:(Math.random()*2-1)*75,y:(Math.random()*2-1)*75}});if(this.state==0) this.screen.startGame();this.timer.set(1);}},setText:function(text){this.text=text;this.textSize={x:this.font.widthForString(text),y:this.font.heightForString(text)};},draw:function(){ig.system.context.beginPath();ig.system.context.fillStyle="rgba(0, 0, 0, 0.5)";ig.system.context.rect(0,0,ig.system.width,ig.system.height);ig.system.context.closePath();ig.system.context.fill();this.image.draw(this.centre.x-(this.image.width*0.5),this.centre.y-(this.image.height*0.5));var splats=this.screen.game.getEntitiesByType(EntitySplat);for(var i=0;ithis.goTimer.delta()){this.goImage.draw((ig.system.width*0.5)-(this.goImage.width*0.5),(ig.system.height*0.5)-(this.goImage.height*0.5));var splats=this.game.getEntitiesByType(EntitySplat);for(var i=0;ithis.highscore){this.highscore=this.score;} this.score=0;this.level=1;this.nextInfectionLevel=10;this.infectionTimer.reset();this.infectionTimer.pause();this.isGameRunning=false;this.isGameOver=true;ig.music.fadeOut(1);this.sessionTimer.pause();this.game.onGameOver();this.endscreen=true;},gameOver:function(){ig.music.fadeOut(1);this.sessionTimer.pause();this.isGameRunning=false;this.isGameOver=true;this.infectionTimer.pause();if(this.score>this.highscore){this.highscore=this.score;} this.gameOverSound.play();this.game.drPus.say(_TEXT_[_CURRENT_LANG_].showGameOverCaption,5);this.game.drPus.defaultAnim=this.game.drPus.anims.sad;this.game.onGameOver();this.changePage('endscreen');this.endscreen=true;},newGerm:function(x,y,selectedShape){var settings={isPuzzle:false,shape:selectedShape!=undefined?selectedShape:Math.floor(Math.random()*6),grid:{x:x,y:y}};return this.game.spawnEntity(EntityGerm,(x*this.GERM_SIZE)+this.GRID_OFFSET.x,(y*this.GERM_SIZE)+this.GRID_OFFSET.y,settings);},forceInfection:function(){if((false==this.isGameOver)&&(true==this.isGameRunning)){this.game.drPus.look('shocked');this.game.drPus.say(_TEXT_[_CURRENT_LANG_].portraitForcedInfection,2);this.nextInfectionTime=(this.baseInfectionTime*this.difficultyModifier)+(10*(1/this.level));this.infectionTimer.set(this.nextInfectionTime);this.addInfection();this.addInfection();this.addInfection();this.infectionSound.play();this.checkGrid();}},addInfection:function(){var side=this.WAIT_AREA_LEFT;var leftOrRight=Math.random();if(leftOrRight>0.5) side=this.WAIT_AREA_RIGHT;var isSpace=false;for(var space=0;spacethis.GRID_OFFSET.x)&&(ig.input.mouse.xthis.GRID_OFFSET.y)&&(ig.input.mouse.y=0){if(0!=this.grid[y][x]) if(this.grid[y][x].shape==shape) return this.countGerms(--x,y,shape,direction,++count);}} else if(direction==2){if(y>=0){if(0!=this.grid[y][x]) if(this.grid[y][x].shape==shape) return this.countGerms(x,--y,shape,direction,++count);}} else if(direction==3){if(y3){outerGerms=countRight*countDown;innerGerms=(countRight-2)*(countDown-2);outside=outerGerms-innerGerms;var down=y+countDown;var right=x+countRight;for(var germY=y;germY3){outerGerms=countLeft*countUp;innerGerms=(countLeft-2)*(countUp-2);outside=outerGerms-innerGerms;var up=y-countUp;var left=x-countLeft;for(var germY=y;germY>up;--germY){for(var germX=x;germX>left;--germX){if((germY==y)||(germY==up+1)||(germX==x)||(germX==left+1)){if(this.grid[germY][germX].shape==shape) --outside;} if(this.grid[germY][germX]!=0) matchedGerms.push(this.grid[germY][germX]);if(outside==0) break;}}}} if(outside!==0){matchedGerms=[];if(countRight+countUp>3){outerGerms=countRight*countUp;innerGerms=(countRight-2)*(countUp-2);outside=outerGerms-innerGerms;var up=y-countUp;var right=x+countRight;for(var germY=y;germY>up;--germY){for(var germX=x;germX3){outerGerms=countLeft*countDown;innerGerms=(countLeft-2)*(countDown-2);outside=outerGerms-innerGerms;var down=y+countDown;var left=x+countLeft;for(var germY=y;germYleft;--germX){if((germY==y)||(germY==down-1)||(germX==x)||(germX==left+1)){if(this.grid[germY][germX].shape==shape) --outside;} if(this.grid[germY][germX]!=0) matchedGerms.push(this.grid[germY][germX]);if(outside==0) break;}}}} var score=0;if(outside==0){for(var index=0;index3) this.game.drPus.look('smile');else this.game.drPus.look('wink');this.splatSound.play();--this.nextInfectionLevel;if(this.nextInfectionLevel==0){++this.level;this.nextInfectionLevel=this.baseNextInfectionLevel+this.level;this.game.drPus.say(_TEXT_[_CURRENT_LANG_].drPusSaysLevelUp);this.game.drPus.look('wink');this.levelUpSound.play();}}},inArray:function(needle){if(typeof Array.prototype.indexOf==='function'){indexOf=Array.prototype.indexOf;}else{indexOf=function(needle){var i=-1,index;for(i=0;i0){if(0!=this.grid[y-1][x]) if(this.grid[y-1][x].health>1) this.grid[y-1][x].receiveDamage(1);} if(x>this.PLAYAREA_LEFT){if(0!=this.grid[y][x-1]) if(this.grid[y][x-1].health>1) this.grid[y][x-1].receiveDamage(1);} if(x1) this.grid[y][x+1].receiveDamage(1);} if(y1) this.grid[y+1][x].receiveDamage(1);}},changePage:function(page){if(page=='music') this.pageManager.setPage(8);else if(page=='sound') this.pageManager.setPage(7);else if(page=='options') this.pageManager.setPage(6);else if(page=='tutorial1') this.pageManager.setPage(1);else if(page=='tutorial2') this.pageManager.setPage(2);else if(page=='tutorial3') this.pageManager.setPage(3);else if(page=='tutorial4') this.pageManager.setPage(4);else if(page=='tutorial5') this.pageManager.setPage(5);else if(page=='endscreen') this.pageManager.setPage(9);else if(page=='skiptutorial') this.pageManager.setPage(10);},pause:function(){var germs=this.game.getEntitiesByType(EntityGerm);for(var i=0;ithis.lifetime){var newParticle=this.createParticle();if(newParticle) this.idleTimer.reset();}},createParticle:function(){var instance;var instanceName=this.targets.random();var newTarget=ig.game.getEntityByName(instanceName);if(!newTarget){this.instances.splice(this.instances.indexOf(instanceName),1);return;} var x=(Math.random()*newTarget.size.x-2)+newTarget.pos.x;var y=newTarget.pos.y+(newTarget.size.y-5);if(this.instances.lengththis.lifetime){this.kill();return;} this.currentAnim.alpha=this.idleTimer.delta().map(this.lifetime-this.fadetime,this.lifetime,1,0)-.2;this.parent();},reset:function(x,y){this.pos.x=x;this.pos.y=y;this.currentAnim.alpha=1;this.idleTimer.reset();},kill:function(){this.currentAnim.alpha=0;this.spawner.pool.push(this);},draw:function(){if(this.currentAnim.alpha<.1) return;this.parent();},handleMovementTrace:function(res){this.parent(res);if(res.collision.x||res.collision.y){this.kill();}}});}); // lib/game/main.js ig.baked=true;ig.module('game.main').requires('game.language','impact.game','plugins.tween-lite','impact.font','game.screens.start-screen','bootstrap.entities.particle-emitter').defines(function(){navigator.sayswho=(function(){var N=navigator.appName,ua=navigator.userAgent,tem;var M=ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);if(M&&(tem=ua.match(/version\/([\.\d]+)/i))!=null)M[2]=tem[1];M=M?[M[1],M[2]]:[N,navigator.appVersion,'-?'];return M;})();ig.System.inject({setGameNow:function(gameClass,startLevel){ig.game=new(gameClass)(startLevel);ig.system.setDelegate(ig.game);},});ig.startNewGame=function(width,height,preloader){ig.main('#canvas',StartScreen,60,width,height,1);if(window.resizeGame) window.resizeGame();};if(typeof(WinJS)=='undefined'){ig.startNewGame(320,480);}});