/*! 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;};Object.defineProperty(Array.prototype,'erase',{value:function(item){for(var i=this.length;i--;){if(this[i]===item){this.splice(i,1);}} return this;}});Object.defineProperty(Array.prototype,'random',{value:function(item){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();}};}); // /home/jgilman/git/purelymental-games/tools/../launcher/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};}); // /home/jgilman/git/purelymental-games/tools/../launcher/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;}});}); // /home/jgilman/git/purelymental-games/tools/../launcher/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();};}); // /home/jgilman/git/purelymental-games/tools/../launcher/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;}}});}); // /home/jgilman/git/purelymental-games/tools/../launcher/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;}};}); // /home/jgilman/git/purelymental-games/tools/../launcher/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}};}};}); // /home/jgilman/git/purelymental-games/tools/../launcher/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);}}}}}});}); // /home/jgilman/git/purelymental-games/tools/../launcher/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=1){displayTime=this.formatForMinutes(seconds);}else{displayTime=this.formatForSeconds(seconds);} displayTime+=":";if(milliseconds<100){displayTime+="0";} displayTime+=Math.floor(milliseconds/10);return displayTime;},formatForSeconds:function(seconds){var displayTime="00";if(seconds<10){displayTime="0"+seconds;}else if(seconds>=10){displayTime=""+seconds;} return displayTime;},formatForMinutes:function(seconds){var displayTime="0:00";if(seconds>=60){displayTime=Math.floor(seconds/60)+":";if(seconds%60<10){displayTime+="0";} displayTime+=seconds%60;}else{displayTime="0:"+this.formatForSeconds(delta);} return displayTime;},draw:function(){ig.draw.reset();ig.draw.setFill(this.clearColor);ig.draw.setStroke(null);ig.draw.rect(0,0,this.size.x,this.size.y);if(this.stopwatchEnabled||this.timerEnabled){this.timerImage.draw(10,10);this.numberFont.draw(this.displayTime,50,12,ig.Font.ALIGN.LEFT);} if(this.lifeEnabled){var lastPipDrawn=620;for(var i=Math.min(this.totalPips-1,this.activePips-1);i>=0;i--){this.trueLifePip.drawActive(lastPipDrawn-i*30,25);} lastPipDrawn-=this.activePips*30;for(var i=0;ithis.pos.x&&ig.input.mouse.x+ig.game.screen.xthis.pos.y&&ig.input.mouse.y+ig.game.screen.y=1){this.currentAnim.alpha=1;this.isDoingFade=false;} if(this.currentAnim.alpha<=0){this.currentAnim.alpha=0;this.isDoingFade=false;}} this.parent();},draw:function(){this.parent();}});Credits=ig.Game.extend({clearColor:"#000000",font:new ig.Font('common/proxima-extrabold-30-white.font.png'),scrollPos:0,creditsText:"Credits\n\n\nProgramming and Game Design:\nJustin Gilman\n\n\nArt and UI Design:\nJason Calleiro\n\n\nServer API:\nScott Shervington",loopCredits:false,endCredits:true,buttonClick:new ig.Sound(pmGameData.assetPath+'common/button-click.*'),init:function(){ig.game.spawnEntity(EntityButton,650,450,{size:{x:128,y:128},animSheet:new ig.AnimationSheet('common/backbutton.png',128,128),onRelease:function(){ig.game.buttonClick.play();ig.system.setGame(MainMenu);}});if(this.font.heightForString(this.creditsText)>ig.system.height){this.loopCredits=true;}},update:function(){if(this.loopCredits){if(this.scrollPos+ig.system.height>-100-this.font.heightForString(this.creditsText)){this.scrollPos--;}else{if(this.endCredits){ig.system.setGame(MainMenu);}else{this.scrollPos=0;}}}else{if(this.scrollPos+ig.system.height>(ig.system.height-this.font.heightForString(this.creditsText))/2){this.scrollPos--;}} this.parent();},draw:function(){this.parent();this.font.draw(this.creditsText,ig.system.width/2,this.scrollPos+ig.system.height,ig.Font.ALIGN.CENTER);}});}); // /home/jgilman/git/purelymental-games/tools/../launcher/lib/plugins/midas/browserinfo.js ig.baked=true;ig.module('plugins.midas.browserinfo').requires('impact.impact').defines(function(){PluginBrowserInfo=function(){this.getName=function(){var name=navigator.appName;var userAgent=navigator.userAgent;var nameMatch=userAgent.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);if(nameMatch){name=nameMatch[1];} return name;};this.getVersion=function(){var version=navigator.appVersion;var userAgent=navigator.userAgent;var versionMatch=userAgent.match(/version\/([\.\d]+)/i);var nameMatch=userAgent.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);if(nameMatch){version=nameMatch[2];if(versionMatch!=null){version=versionMatch[1];}} return version;};this.getMajorVersion=function(){return this.getVersion().split('.')[0];};this.getMinorVersion=function(){return this.getVersion().split('.')[1];};this.shouldBlock=function(browserFilter){for(var i=0;ithis.pos.x&&ig.input.mouse.x+ig.game.screen.xthis.pos.y&&ig.input.mouse.y+ig.game.screen.y0){var currentTweens=[];for(var i=0;i1?1:elapsed;var value=this.easing(elapsed);for(property in valuesDelta){this.propUpdate(property,_object,valuesStart,valuesDelta,value);} if(elapsed>=1){if(this.loopNum==0||!this.loop){this.complete=true;if(this.onComplete)this.onComplete();if(_chained)_chained.start();return false;}else if(this.loop==ig.Tween.Loop.Revert){for(property in valuesStart){this.propSet(property,valuesStart,_object);} _elapsed=0;timer.reset();if(this.loopNum!=-1)this.loopNum--;}else if(this.loop==ig.Tween.Loop.Reverse){var _start={},_end={},_delta={};ig.merge(_start,valuesEnd);ig.merge(_end,valuesStart);ig.merge(valuesStart,_start);ig.merge(valuesEnd,_end);for(property in valuesEnd){this.initDelta(property,valuesDelta,_object,valuesEnd);} _elapsed=0;timer.reset();if(this.loopNum!=-1)this.loopNum--;}}};this.pause=function(){this.paused=true;_elapsed+=timer.delta();};this.resume=function(){this.paused=false;timer.reset();};this.stop=function(doComplete){if(doComplete){this.paused=false;this.complete=false;this.loop=false;_elapsed+=duration;this.update();} this.complete=true;}};ig.Tween.Loop={Revert:1,Reverse:2};ig.Tween.Easing={Linear:{},Quadratic:{},Cubic:{},Quartic:{},Quintic:{},Sinusoidal:{},Exponential:{},Circular:{},Elastic:{},Back:{},Bounce:{}};ig.Tween.Easing.Linear.EaseNone=function(k){return k;};ig.Tween.Easing.Quadratic.EaseIn=function(k){return k*k;};ig.Tween.Easing.Quadratic.EaseOut=function(k){return-k*(k-2);};ig.Tween.Easing.Quadratic.EaseInOut=function(k){if((k*=2)<1)return 0.5*k*k;return-0.5*(--k*(k-2)-1);};ig.Tween.Easing.Cubic.EaseIn=function(k){return k*k*k;};ig.Tween.Easing.Cubic.EaseOut=function(k){return--k*k*k+1;};ig.Tween.Easing.Cubic.EaseInOut=function(k){if((k*=2)<1)return 0.5*k*k*k;return 0.5*((k-=2)*k*k+2);};ig.Tween.Easing.Quartic.EaseIn=function(k){return k*k*k*k;};ig.Tween.Easing.Quartic.EaseOut=function(k){return-(--k*k*k*k-1);} ig.Tween.Easing.Quartic.EaseInOut=function(k){if((k*=2)<1)return 0.5*k*k*k*k;return-0.5*((k-=2)*k*k*k-2);};ig.Tween.Easing.Quintic.EaseIn=function(k){return k*k*k*k*k;};ig.Tween.Easing.Quintic.EaseOut=function(k){return(k=k-1)*k*k*k*k+1;};ig.Tween.Easing.Quintic.EaseInOut=function(k){if((k*=2)<1)return 0.5*k*k*k*k*k;return 0.5*((k-=2)*k*k*k*k+2);};ig.Tween.Easing.Sinusoidal.EaseIn=function(k){return-Math.cos(k*Math.PI/2)+1;};ig.Tween.Easing.Sinusoidal.EaseOut=function(k){return Math.sin(k*Math.PI/2);};ig.Tween.Easing.Sinusoidal.EaseInOut=function(k){return-0.5*(Math.cos(Math.PI*k)-1);};ig.Tween.Easing.Exponential.EaseIn=function(k){return k==0?0:Math.pow(2,10*(k-1));};ig.Tween.Easing.Exponential.EaseOut=function(k){return k==1?1:-Math.pow(2,-10*k)+1;};ig.Tween.Easing.Exponential.EaseInOut=function(k){if(k==0)return 0;if(k==1)return 1;if((k*=2)<1)return 0.5*Math.pow(2,10*(k-1));return 0.5*(-Math.pow(2,-10*(k-1))+2);};ig.Tween.Easing.Circular.EaseIn=function(k){return-(Math.sqrt(1-k*k)-1);};ig.Tween.Easing.Circular.EaseOut=function(k){return Math.sqrt(1-(--k*k));};ig.Tween.Easing.Circular.EaseInOut=function(k){if((k/=0.5)<1)return-0.5*(Math.sqrt(1-k*k)-1);return 0.5*(Math.sqrt(1-(k-=2)*k)+1);};ig.Tween.Easing.Elastic.EaseIn=function(k){var s,a=0.1,p=0.4;if(k==0)return 0;if(k==1)return 1;if(!p)p=0.3;if(!a||a<1){a=1;s=p/4;} else s=p/(2*Math.PI)*Math.asin(1/a);return-(a*Math.pow(2,10*(k-=1))*Math.sin((k-s)*(2*Math.PI)/p));};ig.Tween.Easing.Elastic.EaseOut=function(k){var s,a=0.1,p=0.4;if(k==0)return 0;if(k==1)return 1;if(!p)p=0.3;if(!a||a<1){a=1;s=p/4;} else s=p/(2*Math.PI)*Math.asin(1/a);return(a*Math.pow(2,-10*k)*Math.sin((k-s)*(2*Math.PI)/p)+1);};ig.Tween.Easing.Elastic.EaseInOut=function(k){var s,a=0.1,p=0.4;if(k==0)return 0;if(k==1)return 1;if(!p)p=0.3;if(!a||a<1){a=1;s=p/4;} else s=p/(2*Math.PI)*Math.asin(1/a);if((k*=2)<1)return-0.5*(a*Math.pow(2,10*(k-=1))*Math.sin((k-s)*(2*Math.PI)/p));return a*Math.pow(2,-10*(k-=1))*Math.sin((k-s)*(2*Math.PI)/p)*0.5+1;};ig.Tween.Easing.Back.EaseIn=function(k){var s=1.70158;return k*k*((s+1)*k-s);};ig.Tween.Easing.Back.EaseOut=function(k){var s=1.70158;return(k=k-1)*k*((s+1)*k+s)+1;};ig.Tween.Easing.Back.EaseInOut=function(k){var s=1.70158*1.525;if((k*=2)<1)return 0.5*(k*k*((s+1)*k-s));return 0.5*((k-=2)*k*((s+1)*k+s)+2);};ig.Tween.Easing.Bounce.EaseIn=function(k){return 1-ig.Tween.Easing.Bounce.EaseOut(1-k);};ig.Tween.Easing.Bounce.EaseOut=function(k){if((k/=1)<(1/2.75)){return 7.5625*k*k;}else if(k<(2/2.75)){return 7.5625*(k-=(1.5/2.75))*k+0.75;}else if(k<(2.5/2.75)){return 7.5625*(k-=(2.25/2.75))*k+0.9375;}else{return 7.5625*(k-=(2.625/2.75))*k+0.984375;}};ig.Tween.Easing.Bounce.EaseInOut=function(k){if(k<0.5)return ig.Tween.Easing.Bounce.EaseIn(k*2)*0.5;return ig.Tween.Easing.Bounce.EaseOut(k*2-1)*0.5+0.5;};}); // /home/jgilman/git/purelymental-games/tools/../launcher/lib/com/purelymental/wrongswap/entities/card.js ig.baked=true;ig.module('com.purelymental.wrongswap.entities.card').requires('impact.entity','impact.timer','plugins.midas.imageasset','plugins.midas.imageloader','plugins.tween','plugins.midas.draw').defines(function(){EntityCard=ig.Entity.extend({cardObjects:new ig.Image('wrongswap/animals.png'),cardNames:["chicken","octopus","dolphin","whale","fish","shark","buck","zebra","fox","pig","cow","bat","butterfly fish","goldfish","jellyfish","seahorse","elepant","rhinoceros","hippopotamus","duck","bear","hermit crab","emperor penguin","walrus","lobster","peacock","crab","porpoise","polar bear","squid","lion","flying squirrel","tiger","panda","otter","penguin","deer","horse","frog","gorilla","stork","camel","koala","bunny","giraffe","alligator","turtle","snake","rattlesnake","mouse","dog","bear cub","cat","monkey","snail","sheep","iguana","crow","pelican","woodpecker","owl","owl","racoon","mole","chipmunk","fox"],font:new ig.Font(pmGameData.assetPath+'common/dosis-30-white.font.png'),size:{x:105,y:105},friendImage:null,symbol:0,name:"",isIncorrect:false,padding:10,hover:false,board:null,isReady:false,shakeTimer:null,shakeOffset:{x:0,y:0},init:function(x,y,settings){this.parent(x,y,settings);this.friendImage=new ImageAsset();this.shakeTimer=new ig.Timer();},withinBounds:function(){return ig.input.mouse.x+ig.game.screen.x>this.pos.x&&ig.input.mouse.x+ig.game.screen.xthis.pos.y&&ig.input.mouse.y+ig.game.screen.ysymbol){this.setName(ig.global['friendData'][symbol].name);}else{this.setName(this.cardNames[symbol]);}},setSymbol:function(symbol){this.symbol=symbol;this.friendUrl="";var self=this;if(ig.global['friendData']&&ig.global['friendData'].length>symbol){this.friendUrl=ig.global['friendData'][symbol].icon;} this.friendImage=new ImageAsset();this.imageLoader=new PluginImageLoader();var promise=this.imageLoader.loadImage(this.friendUrl,this.friendImage);promise.always(function(){self.isReady=true;});},triggerShake:function(){this.shakeTimer.set(0.5);}});}); // /home/jgilman/git/purelymental-games/tools/../launcher/lib/com/purelymental/wrongswap/entities/cardboard.js ig.baked=true;ig.module('com.purelymental.wrongswap.entities.cardboard').requires('impact.entity','com.purelymental.wrongswap.entities.card','plugins.midas.imageasset','plugins.midas.imageloader','plugins.midas.arrayutils','plugins.midas.ajax').defines(function(){EntityCardboard=ig.Entity.extend({cards:[],size:{x:800,y:600},loaded:false,friendData:[],init:function(x,y,settings){this.parent(x,y,settings);var cardCount=ig.global['paramData'].setSize;var symbols=[];for(var i=0;i<35;i++){symbols.push(i);} symbols=ig.arrayUtils.shuffle(symbols);for(var i=0;i0){for(var i=0;i0){this.cards[i].pos.x+=this.cards[i-1].pos.x+this.cards[i-1].size.x;}}}},evenlySpaceRow:function(cards,yPos){var minWidth=0;for(var i=0;i0){cards[i].pos.x+=cards[i-1].pos.x+cards[i-1].size.x;}}},shuffleCards:function(){this.cards=ig.arrayUtils.shuffle(this.cards);var victim=this.cards.slice(0,1)[0];var randomAction=Math.floor(Math.random()*4);switch(randomAction){case 0:victim.setSymbolName(this.decoySymbol);break;case 1:victim.isReady=false;victim.setSymbol(this.decoySymbol);break;case 2:case 3:victim.isReady=false;victim.setSymbolName(this.decoySymbol);victim.setSymbol(this.decoySymbol);break;} victim.isIncorrect=true;this.cards=ig.arrayUtils.shuffle(this.cards);this.evenlySpaceCards();},});}); // /home/jgilman/git/purelymental-games/tools/../launcher/lib/plugins/midas/popup.js ig.baked=true;ig.module('plugins.midas.popup').requires('impact.impact','impact.font','plugins.midas.draw').defines(function(){PluginPopup=ig.Class.extend({pos:{x:0,y:0},size:{x:500,y:75},fontSize:{x:0,y:0},padding:{top:20,left:20,bottom:20,right:20},imagePadding:10,font:new ig.Font('common/proxima-semibold-24-white.font.png'),image:new ig.Image('common/pointer.png'),text:"",init:function(text,x,y){this.text=text;this.pos.x=x;this.pos.y=y;this.size.x=this.padding.left+this.padding.right;this.size.y=this.padding.top+this.padding.bottom;if(this.text!=""){this.fontSize.x=this.font.widthForString(this.text);this.fontSize.y=this.font.heightForString(this.text);this.size.x+=this.fontSize.x;this.size.y+=this.fontSize.y;} if(this.image){this.size.x+=this.image.width;if(this.image.height>this.size.y){this.size.y=this.image.height+this.padding.top+this.padding.bottom;}} if(this.image&&this.text!=""){this.size.x+=this.imagePadding;}},update:function(){},draw:function(){ig.draw.setStroke(null);ig.draw.setFill("rgba(0,0,0,0.2)");ig.draw.rect(this.pos.x-this.size.x/2,this.pos.y-this.size.y/2,this.size.x,this.size.y);var textCenter={x:this.pos.x,y:this.pos.y-this.fontSize.y/2};if(this.image){this.image.draw(this.pos.x-(this.size.x/2)+this.padding.left,this.pos.y-this.image.height/2);textCenter.x+=this.image.width/2+this.imagePadding;} if(this.text!=""){this.font.draw(this.text,textCenter.x,textCenter.y,ig.Font.ALIGN.CENTER);}}});}); // /home/jgilman/git/purelymental-games/tools/../launcher/lib/com/purelymental/wrongswap/game.js ig.baked=true;ig.module('com.purelymental.wrongswap.game').requires('impact.game','impact.sound','com.purelymental.wrongswap.entities.cardboard','plugins.midas.draw','plugins.midas.popup','plugins.midas.arrayutils').defines(function(){WrongSwap=ig.Game.extend({clearColor:pmGameData.backgroundColor,state:"loadimages",fadeAlpha:1,board:null,incorrectClicks:0,font:new ig.Font(pmGameData.assetPath+'common/dosis-30-white.font.png'),shakeSound:new ig.Sound(pmGameData.assetPath+"common/shake.*"),correctSound:new ig.Sound(pmGameData.assetPath+"common/correct.*"),incorrectSound:new ig.Sound(pmGameData.assetPath+"common/incorrect.*"),init:function(){ig.global['score']=0;this.fadeAlpha=1;this.memorizePopup=new PluginPopup("Click once you have memorized the cards.",ig.system.width/2,ig.system.height-100);this.pickPopup=new PluginPopup("Click the cards that have changed.",ig.system.width/2,ig.system.height-100);this.board=ig.game.spawnEntity(EntityCardboard,0,0,{});},update:function(){document.body.style.cursor="default";this.parent();ig.global['headerui'].update();switch(this.state){case"loadimages":if(this.board.isReady()){this.state="fadeintomemorize";} break;case"fadeintomemorize":this.fadeAlpha-=0.05;if(this.fadeAlpha<=0){this.fadeAlpha=0;this.state="memorize";} break;case"memorize":if(ig.input.pressed('click')){this.state="fadeout";} break;case"fadeout":this.fadeAlpha+=0.05;if(this.fadeAlpha>=1){this.fadeAlpha=1;this.state="shuffle";} break;case"shuffle":this.board.shuffleCards();this.shakeSound.play();this.state="loadshuffledimages";break;case"loadshuffledimages":if(this.board.isReady()){this.state="fadeinshuffled";} break;case"fadeinshuffled":this.fadeAlpha-=0.05;if(this.fadeAlpha<=0){this.fadeAlpha=0;ig.global['headerui'].startStopwatch();this.state="pickshuffled";} break;}},draw:function(){this.parent();switch(this.state){case"loadimages":case"fadeout":case"fadeintomemorize":case"shuffle":case"loadshuffledimages":case"fadeinshuffled":ig.draw.setStroke(null);ig.draw.setFill("rgba(0,0,0,"+this.fadeAlpha+")");ig.draw.rect(0,0,ig.system.width,ig.system.height);break;case"memorize":this.memorizePopup.draw();break;case"pickshuffled":this.pickPopup.draw();break;} if(this.state=="loadimages"){this.font.draw("Loading...",ig.system.width/2,ig.system.height/2,ig.Font.ALIGN.CENTER);}else if(this.state=="shuffle"||this.state=="fadeout"){this.font.draw("Shuffling...",ig.system.width/2,ig.system.height/2,ig.Font.ALIGN.CENTER);} ig.global['headerui'].draw();},successClick:function(cardClicked){this.correctSound.play();ig.global['gameData'].roundsPlayed+=1;if(ig.global['gameData'].roundsPlayed