/*! 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.yig.system.width){this.targetArea.width=ig.system.width-this.targetArea.x;} if(this.targetArea.y+this.targetArea.height>ig.system.height){this.targetArea.height=ig.system.height-this.targetArea.y;} this.generateNewTarget();this.faceTarget();this.parent(this.pos.x,this.pos.y,settings);},update:function(){switch(ig.game.state){case"waiting":this.vel.x=0;this.vel.y=0;break;case"wandering":if(this.pos==this.target.pos||this.distanceTo(this.target)<10){this.generateNewTarget();this.currentAction="turning";} this.wander();break;case"searching":this.vel.x=0;this.vel.y=0;break;} this.parent();},draw:function(){this.parent();},wander:function(){switch(this.currentAction){case"walking":var targetAngle=this.faceTarget();this.vel.x=Math.cos(targetAngle)*this.speed;this.vel.y=Math.sin(targetAngle)*this.speed;break;case"turning":this.vel.x=0;this.vel.y=0;this.targetAngle=this.angleTo(this.target)+(0.5*Math.PI);if(this.targetAnglethis.targetAngle){this.currentAnim.angle=this.targetAngle;}} break;} if(this.currentAnim.angle==this.targetAngle){this.currentAction="walking";}},faceTarget:function(){var targetAngle=this.angleTo(this.target);this.currentAnim.angle=targetAngle+(0.5*Math.PI);return targetAngle;},generateNewTarget:function(){var newX=Math.floor(Math.random()*this.targetArea.width)+this.targetArea.x;var newY=Math.floor(Math.random()*this.targetArea.height)+this.targetArea.y;if(newYig.system.height-this.size.y/2){newY=ig.system.height-this.size.y/2;} if(newXig.system.width-this.size.x/2){newY=ig.system.width-this.size.x/2;} this.target.pos={x:newX,y:newY};},collideWith:function(other){if(this.recentCollisionTimer.delta()>0.3&&this.currentAction=="walking"){this.generateNewTarget();this.currentAction="turning";this.recentCollisionTimer.set(0);}}});}); // /home/jgilman/git/purelymental-games/tools/../launcher/lib/com/purelymental/swarm/entities/floatersheep.js ig.baked=true;ig.module('com.purelymental.swarm.entities.floatersheep').requires('impact.sound','com.purelymental.swarm.entities.floater').defines(function(){EntityFloatersheep=EntityFloater.extend({zIndex:1,incorrectSound:new ig.Sound(pmGameData.assetPath+"common/incorrect.*"),init:function(x,y,settings){this.parent(x,y,settings);},update:function(){switch(ig.game.state){case"loading":this.currentAnim=this.anims.idle.rewind();this.currentAnim.alpha=0;break;case"fadein":this.currentAnim.alpha+=0.1;if(this.currentAnim.alpha>=1){ig.game.fadeFinished();} break;case"wandering":this.currentAnim.alpha=1;break;case"searching":if(ig.input.state('click')&&!ig.game.wasClicked){if(ig.input.mouse.x>this.pos.x&&ig.input.mouse.xthis.pos.y&&ig.input.mouse.ythis.pos.x&&ig.input.mouse.xthis.pos.y&&ig.input.mouse.ythis.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/swarm/game.js ig.baked=true;ig.module('com.purelymental.swarm.game').requires('impact.game','impact.font','impact.timer','impact.sound','com.purelymental.swarm.entities.floatersheep','com.purelymental.swarm.entities.floaterwolf','com.purelymental.swarm.levels.ground','launcher.ui.header','plugins.midas.ajax','plugins.midas.popup').defines(function(){Swarm=ig.Game.extend({state:"loading",wasClicked:false,sheepClicked:0,wanderingTimer:new ig.Timer(),gameData:{},playTimer:new ig.Timer(),clearColor:"#42AC71",wolves:[],sheep:[],conclusionTimer:new ig.Timer(),buzzingLoop:new ig.Sound(pmGameData.assetPath+"swarm/buzzing-loop.*"),beginPopup:null,sheepFaded:0,roundData:{},init:function(x,y,settings){ig.global['score']=0;this.loadLevel(LevelGround);this.gameData.playTime=0;this.gameData.incorrect=0;this.gameData.wolves=ig.global['paramData'].num_wolves.shift();this.gameData.sheep=ig.global['paramData'].num_sheep.shift();ig.global['headerui'].enableLife();ig.global['headerui'].setPips(0,this.gameData.wolves);ig.global['headerui'].enableStopwatch();for(var i=0;i=0){this.buzzingLoop.stop();this.state="searching";ig.global['headerui'].startStopwatch();}} var remainingWolves=0;for(var i=0;i=this.wolves.length&&this.state=="searching"){this.conclusionTimer.set(0);this.state="finished";ig.global['headerui'].pauseStopwatch();this.roundData.playTime=ig.global['headerui'].getClock();} if(this.conclusionTimer.delta()>1&&this.state=="finished"){this.roundData.incorrect=this.sheepClicked;ig.global['gameData']['incorrect']+=this.roundData.incorrect;ig.global['gameData']['playTime']+=this.roundData.playTime;ig.global['gameData']['rounds'].push(this.roundData);if(ig.global['paramData'].num_wolves.length==0){ig.global["wrapperState"]="ending";ig.system.setGame(GameWrapper);}else{ig.system.setGame(Swarm);}} if(!ig.input.state('click')){this.wasClicked=false;} for(var i=0;i