/*! 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.22',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/midas/git/purelymental-games/tools/../patternrunner/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/midas/git/purelymental-games/tools/../patternrunner/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/midas/git/purelymental-games/tools/../patternrunner/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/midas/git/purelymental-games/tools/../patternrunner/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/midas/git/purelymental-games/tools/../patternrunner/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);},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(){}});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/midas/git/purelymental-games/tools/../patternrunner/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;},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/midas/git/purelymental-games/tools/../patternrunner/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/midas/git/purelymental-games/tools/../patternrunner/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;i0&&this.font===null){if(ig.game.buttonFont!==null)this.font=ig.game.buttonFont;else console.error('If you want to display text, you should provide a font for the button.');}},update:function(){if(this.state!=='hidden'){var _clicked=ig.input.state(this._actionName);if(!this._oldPressed&&_clicked&&this._inButton()){this._startedIn=true;} if(this._startedIn&&this.state!=='deactive'&&this._inButton()){if(_clicked&&!this._oldPressed){this.setState('active');this.pressedDown();} else if(_clicked){this.setState('active');this.pressed();} else if(this._oldPressed){this.setState('idle');this.pressedUp();}} else if(this.state==='active'){this.setState('idle');} if(this._oldPressed&&!_clicked){this._startedIn=false;} this._oldPressed=_clicked;}},draw:function(){if(this.state!=='hidden'){this.parent();if(this.font!==null){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=450){this.vel.x=300;this.vel.y=-150;this.anims.running.rewind();this.currentAnim=this.anims.airborne.rewind();}else{} this.parent();if(this.pos.y+this.size.y>=450){this.pos.y=450-this.size.y;this.currentAnim=this.anims.running;} if(this.pos.x+this.size.x-ig.game.screen.x>=420){this.pos.x=420-this.size.x+ig.game.screen.x;} if(this.pos.x-ig.game.screen.x<=50){this.pos.x=50+ig.game.screen.x;}},draw:function(){this.parent();},collideWith:function(other){if(other instanceof EntityTreasure){ig.game.score+=other.reward;other.kill();}}});}); // /home/midas/git/purelymental-games/tools/../patternrunner/lib/game/levels/templelevel.js ig.baked=true;ig.module('game.levels.templelevel').requires('impact.image','game.entities.runner').defines(function(){LevelTemplelevel={"entities":[{"type":"EntityRunner","x":0,"y":296,"settings":{"name":"indy"}}],"layer":[{"name":"background_jungle","width":10,"height":8,"linkWithCollision":false,"visible":1,"tilesetName":"patternrunner/templetiles.png","repeat":true,"preRender":false,"distance":"1","tilesize":64,"foreground":false,"data":[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[1,1,1,1,1,1,1,1,1,1],[1,1,1,1,1,1,1,1,1,1],[1,1,1,1,1,1,1,1,1,1],[1,1,1,1,1,1,1,1,1,1],[1,1,1,1,1,1,1,1,1,1]]},{"name":"temple_floor","width":10,"height":9,"linkWithCollision":false,"visible":1,"tilesetName":"patternrunner/templetiles.png","repeat":true,"preRender":false,"distance":"1","tilesize":64,"foreground":false,"data":[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[4,4,4,4,4,4,4,4,4,4],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[4,4,4,4,4,4,4,4,4,4],[4,4,4,4,4,4,4,4,4,4]]},{"name":"vines","width":10,"height":8,"linkWithCollision":false,"visible":1,"tilesetName":"patternrunner/templetiles.png","repeat":true,"preRender":false,"distance":"1","tilesize":64,"foreground":false,"data":[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[3,3,0,0,3,0,0,3,0,0],[3,3,0,3,0,0,0,3,0,3],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]}]};LevelTemplelevelResources=[new ig.Image('patternrunner/templetiles.png'),new ig.Image('patternrunner/templetiles.png'),new ig.Image('patternrunner/templetiles.png')];}); // /home/midas/git/purelymental-games/tools/../patternrunner/lib/plugins/tween.js ig.baked=true;ig.module('plugins.tween').requires('impact.entity').defines(function(){if(!Array.prototype.indexOf){Array.prototype.indexOf=function(el,start){var start=start||0;for(var i=0;i0){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/midas/git/purelymental-games/tools/../patternrunner/lib/game/entities/glyph.js ig.baked=true;ig.module('game.entities.glyph').requires('impact.entity','plugins.tween').defines(function(){EntityGlyph=ig.Entity.extend({gravityFactor:0,background:new ig.Image('patternrunner/keycontainer.png'),animSheet:new ig.AnimationSheet('patternrunner/glyphs.png',32,32),highlightedAnimSheet:new ig.AnimationSheet('patternrunner/highlight_glyphs.png',32,32),font:new ig.Font('common/arial_32.font.png'),symbol:0,slot:0,isHighlighted:false,alpha:1,init:function(x,y,settings){this.tween({pos:{y:96}},0.9,{easing:ig.Tween.Easing.Elastic.EaseOut}).start();this.parent(x,y,settings);},update:function(){if(this.alpha<0){this.alpha=0;} if(this.alpha>1){this.alpha=1;} this.parent();},draw:function(){this.parent();ig.system.context.globalAlpha=this.alpha;this.background.draw(this.pos.x,this.pos.y);this.font.draw(this.slot,this.pos.x+26,this.pos.y+38,ig.Font.ALIGN.CENTER);var glyphImage=this.animSheet.image;if(this.isHighlighted){glyphImage=this.highlightedAnimSheet.image;} glyphImage.drawTile(this.pos.x+11,this.pos.y+2,this.symbol,32);ig.system.context.globalAlpha=1;},highlight:function(){this.isHighlighted=true;}});}); // /home/midas/git/purelymental-games/tools/../patternrunner/lib/game/entities/door.js ig.baked=true;ig.module('game.entities.door').requires('impact.entity','game.entities.glyph').defines(function(){EntityDoor=ig.Entity.extend({size:{x:128,y:128},maxVel:{x:1000,y:1000},gravityFactor:0,currentHighlight:null,background:new ig.Image('patternrunner/door_ui.png'),camera:null,isGrounded:false,touchPoint:0,alpha:1,init:function(x,y,settings){this.glyphSheet=new ig.AnimationSheet('patternrunner/glyphs.png',32,32);this.highlightedGlyphSheet=new ig.AnimationSheet('patternrunner/highlight_glyphs.png',32,32),this.parent(x,y,settings);},update:function(){if(this.alpha<0){this.alpha=0;} if(this.alpha>1){this.alpha=1;} if(this.pos.y+this.size.y>440){this.pos.y=440-this.size.y;this.gravityFactor=0;if(!this.isGrounded){this.isGrounded=true;ig.game.rumble();this.touchPoint=this.camera.pos.x;}} if(this.isGrounded&&this.pos.x-ig.game.screen.x+this.touchPoint+this.size.x<0){ig.game.lives--;ig.game.reload();} this.parent();},draw:function(){this.parent();ig.system.context.globalAlpha=this.alpha;var xPos=this.isGrounded?this.pos.x-this.camera.pos.x+this.touchPoint:this.pos.x;var yPos=this.isGrounded?this.pos.y-this.camera.pos.y:this.pos.y;this.background.draw(xPos,yPos);for(var i=0;i0){this.isDead=true;this.kill();}},draw:function(){this.parent();ig.draw.setStroke("#CC9900");ig.draw.setLineWidth(0);ig.draw.setFill("#CC9900");ig.draw.rect(this.pos.x,this.pos.y,3,5);}});}); // /home/midas/git/purelymental-games/tools/../patternrunner/lib/game/entities/particleemitter.js ig.baked=true;ig.module('game.entities.particleemitter').requires('impact.entity','impact.timer','game.entities.particle','plugins.draw').defines(function(){EntityParticleemitter=ig.Entity.extend({size:{x:1,y:1},gravityFactor:0,camera:null,particles:[],init:function(x,y,settings){this.timer=new ig.Timer();this.timer.set(0.2);this.parent(x,y,settings);},update:function(){this.parent();for(var i=this.particles.length-1;i>=0;i--){if(this.particles[i].isDead){this.particles.splice(i,1);}}},spawn:function(amount){if(this.particles.length+amount<10){for(var i=0;i450){this.pos.y=450-this.size.y;} if(this.pos.x+this.size.x-this.camera.x<0){this.kill();} this.parent();},draw:function(){this.parent();var xPos=this.pos.x-this.camera.pos.x;var yPos=this.pos.y-this.camera.pos.y;this.animSheet.image.draw(xPos,yPos,120,0,50,91);}});}); // /home/midas/git/purelymental-games/tools/../patternrunner/lib/game/patternrunnerwin.js ig.baked=true;ig.module('game.patternrunnerwin').requires('impact.game','impact.font','plugins.button').defines(function(){PatternRunnerWin=ig.Game.extend({font:new ig.Font('common/arial_32.font.png'),buttonFont:new ig.Font('common/arial_16_white.font.png'),clearColor:"#FFFFFF",init:function(){ig.input.bind(ig.KEY.MOUSE1,'click');var x=ig.system.width/2,y=ig.system.height/2;ig.game.spawnEntity(Button,x-65,y-32,{font:this.buttonFont,text:['Play Again'],textPos:{x:65,y:26},textAlign:ig.Font.ALIGN.CENTER,size:{x:137,y:65},animSheet:new ig.AnimationSheet('common/button.png',137,65),pressedDown:function(){},pressed:function(){},pressedUp:function(){ig.system.setGame(PatternRunner);}});},update:function(){this.parent();},draw:function(){this.parent();var x=ig.system.width/2,y=ig.system.height/2;this.font.draw('You Win!',x,y-120,ig.Font.ALIGN.CENTER);this.font.draw('Score: '+ig.global['score'],x,y-80,ig.Font.ALIGN.CENTER);}});}); // /home/midas/git/purelymental-games/tools/../patternrunner/lib/game/patternrunnerlose.js ig.baked=true;ig.module('game.patternrunnerlose').requires('impact.game','impact.font','plugins.button').defines(function(){PatternRunnerLose=ig.Game.extend({font:new ig.Font('common/arial_32.font.png'),buttonFont:new ig.Font('common/arial_16_white.font.png'),clearColor:"#FFFFFF",init:function(){ig.input.bind(ig.KEY.MOUSE1,'click');var x=ig.system.width/2,y=ig.system.height/2;ig.game.spawnEntity(Button,x-65,y-32,{font:this.buttonFont,text:['Play Again'],textPos:{x:65,y:26},textAlign:ig.Font.ALIGN.CENTER,size:{x:137,y:65},animSheet:new ig.AnimationSheet('common/button.png',137,65),pressedDown:function(){},pressed:function(){},pressedUp:function(){ig.system.setGame(PatternRunner);}});},update:function(){this.parent();},draw:function(){this.parent();var x=ig.system.width/2,y=ig.system.height/2;this.font.draw('You Lose.',x,y-80,ig.Font.ALIGN.CENTER);}});}); // /home/midas/git/purelymental-games/tools/../patternrunner/lib/plugins/screenshake.js ig.baked=true;ig.module('plugins.screenshake').requires('impact.impact','impact.timer').defines(function(){PluginScreenShake=ig.Class.extend({isStarted:false,period:0,scale:0,duration:0,periodTimer:null,durationTimer:null,scaleFlux:0,lastOffset:{x:0,y:0},nextOffset:{x:0,y:0},currentOffset:{x:0,y:0},init:function(period,scale,duration){this.period=period;this.scale=scale;this.duration=duration;this.durationTimer=new ig.Timer();this.periodTimer=new ig.Timer();},newNextOffset:function(){this.nextOffset.x=Math.random()*this.scaleFlux;this.nextOffset.y=Math.random()*this.scaleFlux;},start:function(){this.durationTimer.set(this.duration);this.periodTimer.set(this.period);this.scaleFlux=this.scale;this.lastOffset={x:0,y:0};this.newNextOffset();this.isStarted=true;},update:function(){if(!this.isStarted){return;} var periodDelta=this.periodTimer.delta();var shakeDelta=this.durationTimer.delta();if(periodDelta<0){this.currentOffset.x=this.nextOffset.x+(this.lastOffset.x-this.nextOffset.x)*(-periodDelta/this.period);this.currentOffset.y=this.nextOffset.y+(this.lastOffset.y-this.nextOffset.y)*(-periodDelta/this.period);}else if(shakeDelta<0){this.lastOffset=this.currentOffset;this.newNextOffset();this.periodTimer.set(this.period);}else if(this.shakeFlux>0.001){this.shakeFlux*=0.5;this.lastOffset=this.currentOffset;this.newNextOffset();this.periodTimer.set(this.period);}else{this.stop();}},stop:function(){this.lastOffset={x:0,y:0};this.currentOffset={x:0,y:0};this.isStarted=false;},getCurrentOffset:function(){return this.currentOffset;},updateScreen:function(){originalPos=ig.screen;ig.screen=this.getCurrentOffset();}});}); // /home/midas/git/purelymental-games/tools/../patternrunner/lib/plugins/camera.js ig.baked=true;ig.module('plugins.camera').requires('impact.impact','plugins.screenshake').defines(function(){PluginCamera=ig.Class.extend({game:null,screenshake:null,pos:{x:0,y:0},init:function(game){this.game=game;this.screenshake=new PluginScreenShake(0.02,8,0.5);},update:function(){this.screenshake.update();var offset=this.screenshake.getCurrentOffset();this.game.screen.x=this.pos.x+offset.x;this.game.screen.y=this.pos.y+offset.y;},shake:function(){this.screenshake.start();}});}); // /home/midas/git/purelymental-games/tools/../patternrunner/lib/plugins/arrayutils.js ig.baked=true;ig.module('plugins.arrayutils').requires('impact.impact').defines(function(){PluginArrayUtils=function(){this.shuffle=function(obj){var rand;var index=0;var shuffled=[];this.each(obj,function(value){rand=Math.floor(Math.random()*index) shuffled[index]=shuffled[rand];index++;shuffled[rand]=value;});return shuffled;};this.each=function(obj,iterator,context){if(obj==null)return;for(var key in obj){if(this.has(obj,key)){if(iterator.call(context,obj[key],key,obj)==={})return;}}};this.has=function(obj,key){return obj.hasOwnProperty(key);};this.contains=function(needle,haystack){for(var i=0;i0){var glyphs=this.getEntitiesByType('EntityGlyph');for(var i=0;i=0){ig.global['score']=this.score*this.lives;this.gameData.score=this.score;this.gameData.livesLost=3-this.lives;ig.ajax.post("/api/games/4/finish.json",this.gameData);ig.system.setGame(PatternRunnerWin);}},draw:function(){this.parent();this.font.draw("Score: "+this.score,5,5,ig.Font.ALIGN.LEFT);this.font.draw("Lives: "+this.lives,490,5,ig.Font.ALIGN.LEFT);var timeRemaining=-1*Math.floor(this.gameTimer.delta());if(timeRemaining<0){timeRemaining=0;} var minuteDisplay=Math.floor(timeRemaining/60);var secondDisplay=Math.floor(timeRemaining%60);if(Math.floor(timeRemaining%60)<10){secondDisplay="0"+secondDisplay;} this.font.draw(minuteDisplay+":"+secondDisplay,300,5,ig.Font.ALIGN.CENTER);},rumble:function(){this.camera.shake();this.particleEmitter.spawn(Math.random()*10);},reload:function(){this.door.kill();var glyphs=this.getEntitiesByType('EntityGlyph');for(var i=0;i