diff --git a/Docs/Hello Phaser/index.html b/Docs/Hello Phaser/index.html new file mode 100644 index 00000000..2f1124bb --- /dev/null +++ b/Docs/Hello Phaser/index.html @@ -0,0 +1,37 @@ + + +
+>16&255)/255,(b>>8&255)/255,(b&255)/255]}PIXI._defaultFrame=new PIXI.Rectangle(0,0,1,1);PIXI.gl;PIXI.WebGLRenderer=function(g,b,d,j,c){this.transparent=!!j;this.width=g||800;this.height=b||600;this.view=d||document.createElement("canvas");this.view.width=this.width;this.view.height=this.height;var f=this;this.view.addEventListener("webglcontextlost",function(e){f.handleContextLost(e)},false);this.view.addEventListener("webglcontextrestored",function(e){f.handleContextRestored(e)},false);this.batchs=[];try{PIXI.gl=this.gl=this.view.getContext("experimental-webgl",{alpha:this.transparent,antialias:!!c,premultipliedAlpha:false,stencil:true})}catch(h){throw new Error(" This browser does not support webGL. Try using the canvas renderer"+this)}PIXI.initPrimitiveShader();PIXI.initDefaultShader();PIXI.initDefaultStripShader();PIXI.activateDefaultShader();var i=this.gl;PIXI.WebGLRenderer.gl=i;this.batch=new PIXI.WebGLBatch(i);i.disable(i.DEPTH_TEST);i.disable(i.CULL_FACE);i.enable(i.BLEND);i.colorMask(true,true,true,this.transparent);PIXI.projection=new PIXI.Point(400,300);this.resize(this.width,this.height);this.contextLost=false;this.stageRenderGroup=new PIXI.WebGLRenderGroup(this.gl)};PIXI.WebGLRenderer.prototype.constructor=PIXI.WebGLRenderer;PIXI.WebGLRenderer.getBatch=function(){if(PIXI._batchs.length==0){return new PIXI.WebGLBatch(PIXI.WebGLRenderer.gl)}else{return PIXI._batchs.pop()}};PIXI.WebGLRenderer.returnBatch=function(b){b.clean();PIXI._batchs.push(b)};PIXI.WebGLRenderer.prototype.render=function(b){if(this.contextLost){return}if(this.__stage!==b){this.__stage=b;this.stageRenderGroup.setRenderable(b)}PIXI.WebGLRenderer.updateTextures();PIXI.visibleCount++;b.updateTransform();var d=this.gl;d.colorMask(true,true,true,this.transparent);d.viewport(0,0,this.width,this.height);d.bindFramebuffer(d.FRAMEBUFFER,null);d.clearColor(b.backgroundColorSplit[0],b.backgroundColorSplit[1],b.backgroundColorSplit[2],!this.transparent);d.clear(d.COLOR_BUFFER_BIT);this.stageRenderGroup.backgroundColor=b.backgroundColorSplit;this.stageRenderGroup.render(PIXI.projection);if(b.interactive){if(!b._interactiveEventsAdded){b._interactiveEventsAdded=true;b.interactionManager.setTarget(this)}}if(PIXI.Texture.frameUpdates.length>0){for(var c=0;c0){n=n.children[n.children.length-1];if(n.renderable){b=n}}if(b instanceof PIXI.Sprite){c=b.batch;var l=c.head;if(l==b){h=0}else{h=1;while(l.__next!=b){h++;l=l.__next}}}else{c=b}if(m==c){if(m instanceof PIXI.WebGLBatch){m.render(p,h+1)}else{this.renderSpecial(m,j)}return}d=this.batchs.indexOf(m);q=this.batchs.indexOf(c);if(m instanceof PIXI.WebGLBatch){m.render(p)}else{this.renderSpecial(m,j)}for(var e=d+1;e =2?parseInt(b[b.length-2],10):PIXI.BitmapText.fonts[this.fontName].size;this.dirty=true};PIXI.BitmapText.prototype.updateText=function(){var h=PIXI.BitmapText.fonts[this.fontName];var m=new PIXI.Point();var j=null;var l=[];var q=0;var e=[];var p=0;var f=this.fontSize/h.size;for(var g=0;g0){this.removeChild(this.getChildAt(0))}this.updateText();this.dirty=false}PIXI.DisplayObjectContainer.prototype.updateTransform.call(this)};PIXI.BitmapText.fonts={};PIXI.Text=function(c,b){this.canvas=document.createElement("canvas");this.context=this.canvas.getContext("2d");PIXI.Sprite.call(this,PIXI.Texture.fromCanvas(this.canvas));this.setText(c);this.setStyle(b);this.updateText();this.dirty=false};PIXI.Text.prototype=Object.create(PIXI.Sprite.prototype);PIXI.Text.prototype.constructor=PIXI.Text;PIXI.Text.prototype.setStyle=function(b){b=b||{};b.font=b.font||"bold 20pt Arial";b.fill=b.fill||"black";b.align=b.align||"left";b.stroke=b.stroke||"black";b.strokeThickness=b.strokeThickness||0;b.wordWrap=b.wordWrap||false;b.wordWrapWidth=b.wordWrapWidth||100;this.style=b;this.dirty=true};PIXI.Sprite.prototype.setText=function(b){this.text=b.toString()||" ";this.dirty=true};PIXI.Text.prototype.updateText=function(){this.context.font=this.style.font;var g=this.text;if(this.style.wordWrap){g=this.wordWrap(this.text)}var f=g.split(/(?:\r\n|\r|\n)/);var d=[];var c=0;for(var h=0;h j){return k}else{return arguments.callee(i,l,k,h,j)}}else{return arguments.callee(i,l,m,k,j)}};var f=function(h,j,i){if(h.measureText(j).width<=i||j.length<1){return j}var k=e(h,j,0,j.length,i);return j.substring(0,k)+"\n"+arguments.callee(h,j.substring(k),i)};var b="";var c=g.split("\n");for(var d=0;d this.baseTexture.width||b.y+b.height>this.baseTexture.height){throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this)}this.updateFrame=true;PIXI.Texture.frameUpdates.push(this)};PIXI.Texture.fromImage=function(c,b){var d=PIXI.TextureCache[c];if(!d){d=new PIXI.Texture(PIXI.BaseTexture.fromImage(c,b));PIXI.TextureCache[c]=d}return d};PIXI.Texture.fromFrame=function(c){var b=PIXI.TextureCache[c];if(!b){throw new Error("The frameId '"+c+"' does not exist in the texture cache "+this)}return b};PIXI.Texture.fromCanvas=function(b){var c=new PIXI.BaseTexture(b);return new PIXI.Texture(c)};PIXI.Texture.addTextureToCache=function(b,c){PIXI.TextureCache[c]=b};PIXI.Texture.removeTextureFromCache=function(c){var b=PIXI.TextureCache[c];PIXI.TextureCache[c]=null;return b};PIXI.Texture.frameUpdates=[];PIXI.RenderTexture=function(c,b){PIXI.EventTarget.call(this);this.width=c||100;this.height=b||100;this.indetityMatrix=PIXI.mat3.create();this.frame=new PIXI.Rectangle(0,0,this.width,this.height);if(PIXI.gl){this.initWebGL()}else{this.initCanvas()}};PIXI.RenderTexture.prototype=Object.create(PIXI.Texture.prototype);PIXI.RenderTexture.prototype.constructor=PIXI.RenderTexture;PIXI.RenderTexture.prototype.initWebGL=function(){var b=PIXI.gl;this.glFramebuffer=b.createFramebuffer();b.bindFramebuffer(b.FRAMEBUFFER,this.glFramebuffer);this.glFramebuffer.width=this.width;this.glFramebuffer.height=this.height;this.baseTexture=new PIXI.BaseTexture();this.baseTexture.width=this.width;this.baseTexture.height=this.height;this.baseTexture._glTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,this.baseTexture._glTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,this.width,this.height,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);this.baseTexture.isRender=true;b.bindFramebuffer(b.FRAMEBUFFER,this.glFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,this.baseTexture._glTexture,0);this.projection=new PIXI.Point(this.width/2,this.height/2);this.render=this.renderWebGL};PIXI.RenderTexture.prototype.resize=function(c,b){this.width=c;this.height=b;if(PIXI.gl){this.projection.x=this.width/2;this.projection.y=this.height/2;var d=PIXI.gl;d.bindTexture(d.TEXTURE_2D,this.baseTexture._glTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,this.width,this.height,0,d.RGBA,d.UNSIGNED_BYTE,null)}else{this.frame.width=this.width;this.frame.height=this.height;this.renderer.resize(this.width,this.height)}};PIXI.RenderTexture.prototype.initCanvas=function(){this.renderer=new PIXI.CanvasRenderer(this.width,this.height,null,0);this.baseTexture=new PIXI.BaseTexture(this.renderer.view);this.frame=new PIXI.Rectangle(0,0,this.width,this.height);this.render=this.renderCanvas};PIXI.RenderTexture.prototype.renderWebGL=function(k,g,h){var f=PIXI.gl;f.colorMask(true,true,true,true);f.viewport(0,0,this.width,this.height);f.bindFramebuffer(f.FRAMEBUFFER,this.glFramebuffer);if(h){f.clearColor(0,0,0,0);f.clear(f.COLOR_BUFFER_BIT)}var c=k.children;var b=k.worldTransform;k.worldTransform=PIXI.mat3.create();k.worldTransform[4]=-1;k.worldTransform[5]=this.projection.y*2;if(g){k.worldTransform[2]=g.x;k.worldTransform[5]-=g.y}PIXI.visibleCount++;k.vcount=PIXI.visibleCount;for(var e=0,d=c.length;e >1;if(k<3){return[]}var u=[];var g=[];for(var s=0;s 3){var q=g[(s+0)%o];var m=g[(s+1)%o];var l=g[(s+2)%o];var f=h[2*q],d=h[2*q+1];var v=h[2*m],t=h[2*m+1];var c=h[2*l],b=h[2*l+1];var e=false;if(PIXI.PolyK._convex(f,d,v,t,c,b,z)){e=true;for(var r=0;r 3*o){if(z){var u=[];g=[];for(var s=0;s =0)&&(m>=0)&&(n+m<1)};PIXI.PolyK._convex=function(e,d,g,f,b,h,c){return((d-f)*(b-g)+(g-e)*(h-f)>=0)==c};Phaser.Camera=function(d,g,c,f,e,b){this.game=d;this.world=d.world;this.id=0;this.view=new Phaser.Rectangle(c,f,e,b);this.screenView=new Phaser.Rectangle(c,f,e,b);this.deadzone=null;this.visible=true;this.atLimit={x:false,y:false};this.target=null;this._edge=0};Phaser.Camera.FOLLOW_LOCKON=0;Phaser.Camera.FOLLOW_PLATFORMER=1;Phaser.Camera.FOLLOW_TOPDOWN=2;Phaser.Camera.FOLLOW_TOPDOWN_TIGHT=3;Phaser.Camera.prototype={follow:function(f,d){if(typeof d==="undefined"){d=Phaser.Camera.FOLLOW_LOCKON}this.target=f;var e;switch(d){case Phaser.Camera.FOLLOW_PLATFORMER:var b=this.width/8;var c=this.height/3;this.deadzone=new Phaser.Rectangle((this.width-b)/2,(this.height-c)/2-c*0.25,b,c);break;case Phaser.Camera.FOLLOW_TOPDOWN:e=Math.max(this.width,this.height)/4;this.deadzone=new Phaser.Rectangle((this.width-e)/2,(this.height-e)/2,e,e);break;case Phaser.Camera.FOLLOW_TOPDOWN_TIGHT:e=Math.max(this.width,this.height)/8;this.deadzone=new Phaser.Rectangle((this.width-e)/2,(this.height-e)/2,e,e);break;case Phaser.Camera.FOLLOW_LOCKON:default:this.deadzone=null;break}},focusOnXY:function(b,c){this.view.x=Math.round(b-this.view.halfWidth);this.view.y=Math.round(c-this.view.halfHeight)},update:function(){if(this.target!==null){if(this.deadzone){this._edge=this.target.x-this.deadzone.x;if(this.view.x>this._edge){this.view.x=this._edge}this._edge=this.target.x+this.target.width-this.deadzone.x-this.deadzone.width;if(this.view.x this._edge){this.view.y=this._edge}this._edge=this.target.y+this.target.height-this.deadzone.y-this.deadzone.height;if(this.view.y this.world.bounds.right-this.width){this.atLimit.x=true;this.view.x=(this.world.bounds.right-this.width)+1}if(this.view.y this.world.bounds.bottom-this.height){this.atLimit.y=true;this.view.y=(this.world.bounds.bottom-this.height)+1}this.view.floor()},setPosition:function(b,c){this.view.x=b;this.view.y=c;this.checkWorldBounds()},setSize:function(c,b){this.view.width=c;this.view.height=b}};Object.defineProperty(Phaser.Camera.prototype,"x",{get:function(){return this.view.x},set:function(b){this.view.x=b;this.checkWorldBounds()}});Object.defineProperty(Phaser.Camera.prototype,"y",{get:function(){return this.view.y},set:function(b){this.view.y=b;this.checkWorldBounds()}});Object.defineProperty(Phaser.Camera.prototype,"width",{get:function(){return this.view.width},set:function(b){this.view.width=b}});Object.defineProperty(Phaser.Camera.prototype,"height",{get:function(){return this.view.height},set:function(b){this.view.height=b}});Phaser.State=function(){this.game=null;this.add=null;this.camera=null;this.cache=null;this.input=null;this.load=null;this.sound=null;this.stage=null;this.time=null;this.tweens=null;this.world=null;this.particles=null;this.physics=null};Phaser.State.prototype={link:function(b){this.game=b;this.add=b.add;this.camera=b.camera;this.cache=b.cache;this.input=b.input;this.load=b.load;this.sound=b.sound;this.stage=b.stage;this.time=b.time;this.tweens=b.tweens;this.world=b.world;this.particles=b.particles;this.physics=b.physics},preload:function(){},create:function(){},update:function(){},render:function(){},paused:function(){},destroy:function(){}};Phaser.StateManager=function(c,b){this.game=c;this.states={};if(b!==null){this._pendingState=b}};Phaser.StateManager.prototype={game:null,_pendingState:null,_created:false,states:{},current:"",onInitCallback:null,onPreloadCallback:null,onCreateCallback:null,onUpdateCallback:null,onRenderCallback:null,onPreRenderCallback:null,onLoadUpdateCallback:null,onLoadRenderCallback:null,onPausedCallback:null,onShutDownCallback:null,boot:function(){if(this._pendingState!==null){if(typeof this._pendingState==="string"){this.start(this._pendingState,false,false)}else{this.add("default",this._pendingState,true)}}},add:function(c,d,b){if(typeof b==="undefined"){b=false}var e;if(d instanceof Phaser.State){e=d;e.link(this.game)}else{if(typeof d==="object"){e=d}else{if(typeof d==="function"){e=new d(this.game)}}}this.states[c]=e;if(b){if(this.game.isBooted){this.start(c)}else{this._pendingState=c}}return e},remove:function(b){if(this.current==b){this.callbackContext=null;this.onInitCallback=null;this.onShutDownCallback=null;this.onPreloadCallback=null;this.onLoadRenderCallback=null;this.onLoadUpdateCallback=null;this.onCreateCallback=null;this.onUpdateCallback=null;this.onRenderCallback=null;this.onPausedCallback=null;this.onDestroyCallback=null}delete this.states[b]},start:function(c,b,d){if(typeof b==="undefined"){b=true}if(typeof d==="undefined"){d=false}if(this.game.isBooted==false){this._pendingState=c;return}if(this.checkState(c)==false){return}else{if(this.current){this.onShutDownCallback.call(this.callbackContext)}if(b){if(d==true){this.game.cache.destroy()}}this.setCurrentState(c)}if(this.onPreloadCallback){this.game.load.reset();this.onPreloadCallback.call(this.callbackContext);if(this.game.load.queueSize==0){this.game.loadComplete();if(this.onCreateCallback){this.onCreateCallback.call(this.callbackContext)}this._created=true}else{this.game.load.start()}}else{if(this.onCreateCallback){this.onCreateCallback.call(this.callbackContext)}this._created=true;this.game.loadComplete()}},dummy:function(){},checkState:function(b){if(this.states[b]){var c=false;if(this.states[b]["preload"]){c=true}if(c==false&&this.states[b]["loadRender"]){c=true}if(c==false&&this.states[b]["loadUpdate"]){c=true}if(c==false&&this.states[b]["create"]){c=true}if(c==false&&this.states[b]["update"]){c=true}if(c==false&&this.states[b]["preRender"]){c=true}if(c==false&&this.states[b]["render"]){c=true}if(c==false&&this.states[b]["paused"]){c=true}if(c==false){console.warn("Invalid Phaser State object given. Must contain at least a one of the required functions.");return false}return true}else{console.warn("Phaser.StateManager - No state found with the key: "+b);return false}},setCurrentState:function(b){this.callbackContext=this.states[b];this.onInitCallback=this.states[b]["init"]||this.dummy;this.onPreloadCallback=this.states[b]["preload"]||null;this.onLoadRenderCallback=this.states[b]["loadRender"]||null;this.onLoadUpdateCallback=this.states[b]["loadUpdate"]||null;this.onCreateCallback=this.states[b]["create"]||null;this.onUpdateCallback=this.states[b]["update"]||null;this.onPreRenderCallback=this.states[b]["preRender"]||null;this.onRenderCallback=this.states[b]["render"]||null;this.onPausedCallback=this.states[b]["paused"]||null;this.onShutDownCallback=this.states[b]["shutdown"]||this.dummy;this.current=b;this._created=false;this.onInitCallback.call(this.callbackContext)},loadComplete:function(){if(this._created==false&&this.onCreateCallback){this.onCreateCallback.call(this.callbackContext);this._created=true}},update:function(){if(this._created&&this.onUpdateCallback){this.onUpdateCallback.call(this.callbackContext)}else{if(this.onLoadUpdateCallback){this.onLoadUpdateCallback.call(this.callbackContext)}}},preRender:function(){if(this.onPreRenderCallback){this.onPreRenderCallback.call(this.callbackContext)}},render:function(){if(this._created&&this.onRenderCallback){this.onRenderCallback.call(this.callbackContext)}else{if(this.onLoadRenderCallback){this.onLoadRenderCallback.call(this.callbackContext)}}},destroy:function(){this.callbackContext=null;this.onInitCallback=null;this.onShutDownCallback=null;this.onPreloadCallback=null;this.onLoadRenderCallback=null;this.onLoadUpdateCallback=null;this.onCreateCallback=null;this.onUpdateCallback=null;this.onRenderCallback=null;this.onPausedCallback=null;this.onDestroyCallback=null;this.game=null;this.states={};this._pendingState=null}};Phaser.LinkedList=function(){this.next=null;this.prev=null;this.first=null;this.last=null;this.total=0};Phaser.LinkedList.prototype={add:function(b){if(this.total==0&&this.first==null&&this.last==null){this.first=b;this.last=b;this.next=b;b.prev=this;this.total++;return}this.last.next=b;b.prev=this.last;this.last=b;this.total++;return b},remove:function(c){if(this.first==null&&this.last==null){return}this.total--;if(this.first==c&&this.last==c){this.first=null;this.last=null;this.next=null;c.next=null;c.prev=null;return}var b=c.prev;if(c.next){c.next.prev=c.prev}b.next=c.next},callAll:function(c){var b=this.first;do{if(b[c]){b[c].call(b)}b=b.next}while(b!=this.last.next)},dump:function(){var j=20;var e="\n"+Phaser.Utils.pad("Node",j)+"|"+Phaser.Utils.pad("Next",j)+"|"+Phaser.Utils.pad("Previous",j)+"|"+Phaser.Utils.pad("First",j)+"|"+Phaser.Utils.pad("Last",j);console.log(e);var e=Phaser.Utils.pad("----------",j)+"|"+Phaser.Utils.pad("----------",j)+"|"+Phaser.Utils.pad("----------",j)+"|"+Phaser.Utils.pad("----------",j)+"|"+Phaser.Utils.pad("----------",j);console.log(e);var g=this;var c=g.last.next;g=g.first;do{var d=g.sprite.name||"*";var f="-";var b="-";var h="-";var i="-";if(g.next){f=g.next.sprite.name}if(g.prev){b=g.prev.sprite.name}if(g.first){h=g.first.sprite.name}if(g.last){i=g.last.sprite.name}if(typeof f==="undefined"){f="-"}if(typeof b==="undefined"){b="-"}if(typeof h==="undefined"){h="-"}if(typeof i==="undefined"){i="-"}var e=Phaser.Utils.pad(d,j)+"|"+Phaser.Utils.pad(f,j)+"|"+Phaser.Utils.pad(b,j)+"|"+Phaser.Utils.pad(h,j)+"|"+Phaser.Utils.pad(i,j);console.log(e);g=g.next}while(g!=c)}};Phaser.Signal=function(){this._bindings=[];this._prevParams=null;var b=this;this.dispatch=function(){Phaser.Signal.prototype.dispatch.apply(b,arguments)}};Phaser.Signal.prototype={memorize:false,_shouldPropagate:true,active:true,validateListener:function(b,c){if(typeof b!=="function"){throw new Error("listener is a required param of {fn}() and should be a Function.".replace("{fn}",c))}},_registerListener:function(f,d,e,c){var b=this._indexOfListener(f,e),g;if(b!==-1){g=this._bindings[b];if(g.isOnce()!==d){throw new Error("You cannot add"+(d?"":"Once")+"() then add"+(!d?"":"Once")+"() the same listener without removing the relationship first.")}}else{g=new Phaser.SignalBinding(this,f,d,e,c);this._addBinding(g)}if(this.memorize&&this._prevParams){g.execute(this._prevParams)}return g},_addBinding:function(b){var c=this._bindings.length;do{--c}while(this._bindings[c]&&b._priority<=this._bindings[c]._priority);this._bindings.splice(c+1,0,b)},_indexOfListener:function(c,b){var e=this._bindings.length,d;while(e--){d=this._bindings[e];if(d._listener===c&&d.context===b){return e}}return -1},has:function(c,b){return this._indexOfListener(c,b)!==-1},add:function(d,c,b){this.validateListener(d,"add");return this._registerListener(d,false,c,b)},addOnce:function(d,c,b){this.validateListener(d,"addOnce");return this._registerListener(d,true,c,b)},remove:function(d,c){this.validateListener(d,"remove");var b=this._indexOfListener(d,c);if(b!==-1){this._bindings[b]._destroy();this._bindings.splice(b,1)}return d},removeAll:function(){var b=this._bindings.length;while(b--){this._bindings[b]._destroy()}this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=false},dispatch:function(c){if(!this.active){return}var b=Array.prototype.slice.call(arguments),e=this._bindings.length,d;if(this.memorize){this._prevParams=b}if(!e){return}d=this._bindings.slice();this._shouldPropagate=true;do{e--}while(d[e]&&this._shouldPropagate&&d[e].execute(b)!==false)},forget:function(){this._prevParams=null},dispose:function(){this.removeAll();delete this._bindings;delete this._prevParams},toString:function(){return"[Phaser.Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}};Phaser.SignalBinding=function(f,e,c,d,b){this._listener=e;this._isOnce=c;this.context=d;this._signal=f;this._priority=b||0};Phaser.SignalBinding.prototype={active:true,params:null,execute:function(b){var d,c;if(this.active&&!!this._listener){c=this.params?this.params.concat(b):b;d=this._listener.apply(this.context,c);if(this._isOnce){this.detach()}}return d},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return(!!this._signal&&!!this._listener)},isOnce:function(){return this._isOnce},getListener:function(){return this._listener},getSignal:function(){return this._signal},_destroy:function(){delete this._signal;delete this._listener;delete this.context},toString:function(){return"[Phaser.SignalBinding isOnce:"+this._isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}};Phaser.Plugin=function(b,c){this.game=b;this.parent=c;this.active=false;this.visible=false;this.hasPreUpdate=false;this.hasUpdate=false;this.hasRender=false;this.hasPostRender=false};Phaser.Plugin.prototype={preUpdate:function(){},update:function(){},render:function(){},postRender:function(){},destroy:function(){this.game=null;this.parent=null;this.active=false;this.visible=false}};Phaser.PluginManager=function(b,c){this.game=b;this._parent=c;this.plugins=[];this._pluginsLength=0};Phaser.PluginManager.prototype={add:function(c){var b=false;if(typeof c==="function"){c=new c(this.game,this._parent)}else{c.game=this.game;c.parent=this._parent}if(typeof c.preUpdate==="function"){c.hasPreUpdate=true;b=true}if(typeof c.update==="function"){c.hasUpdate=true;b=true}if(typeof c.render==="function"){c.hasRender=true;b=true}if(typeof c.postRender==="function"){c.hasPostRender=true;b=true}if(b){if(c.hasPreUpdate||c.hasUpdate){c.active=true}if(c.hasRender||c.hasPostRender){c.visible=true}this._pluginsLength=this.plugins.push(c);return c}else{return null}},remove:function(b){this._pluginsLength--},preUpdate:function(){if(this._pluginsLength==0){return}for(this._p=0;this._p 0)},removeBetween:function(d,c){if(d>c||d<0||c>this._container.children.length){return false}for(var b=d;b =this.game.width){this.bounds.width=c}if(b>=this.game.height){this.bounds.height=b}}};Object.defineProperty(Phaser.World.prototype,"width",{get:function(){return this.bounds.width},set:function(b){this.bounds.width=b}});Object.defineProperty(Phaser.World.prototype,"height",{get:function(){return this.bounds.height},set:function(b){this.bounds.height=b}});Object.defineProperty(Phaser.World.prototype,"centerX",{get:function(){return this.bounds.halfWidth}});Object.defineProperty(Phaser.World.prototype,"centerY",{get:function(){return this.bounds.halfHeight}});Object.defineProperty(Phaser.World.prototype,"randomX",{get:function(){return Math.round(Math.random()*this.bounds.width)}});Object.defineProperty(Phaser.World.prototype,"randomY",{get:function(){return Math.round(Math.random()*this.bounds.height)}});Phaser.Game=function(e,b,g,d,f,h,c){e=e||800;b=b||600;g=g||Phaser.AUTO;d=d||"";f=f||null;h=h||false;c=c||true;this.id=Phaser.GAMES.push(this)-1;this.parent=d;this.width=e;this.height=b;this.transparent=h;this.antialias=c;this.renderer=null;this.state=new Phaser.StateManager(this,f);this._paused=false;this.renderType=g;this._loadComplete=false;this.isBooted=false;this.isRunning=false;this.raf=null;this.add=null;this.cache=null;this.input=null;this.load=null;this.math=null;this.net=null;this.sound=null;this.stage=null;this.time=null;this.tweens=null;this.world=null;this.physics=null;this.rnd=null;this.device=null;this.camera=null;this.canvas=null;this.context=null;this.debug=null;this.particles=null;var i=this;this._onBoot=function(){return i.boot()};if(document.readyState==="complete"||document.readyState==="interactive"){window.setTimeout(this._onBoot,0)}else{document.addEventListener("DOMContentLoaded",this._onBoot,false);window.addEventListener("load",this._onBoot,false)}return this};Phaser.Game.prototype={boot:function(){if(this.isBooted){return}if(!document.body){window.setTimeout(this._onBoot,20)}else{document.removeEventListener("DOMContentLoaded",this._onBoot);window.removeEventListener("load",this._onBoot);this.onPause=new Phaser.Signal;this.onResume=new Phaser.Signal;this.isBooted=true;this.device=new Phaser.Device();this.math=Phaser.Math;this.rnd=new Phaser.RandomDataGenerator([(Date.now()*Math.random()).toString()]);this.stage=new Phaser.Stage(this,this.width,this.height);this.setUpRenderer();this.world=new Phaser.World(this);this.add=new Phaser.GameObjectFactory(this);this.cache=new Phaser.Cache(this);this.load=new Phaser.Loader(this);this.time=new Phaser.Time(this);this.tweens=new Phaser.TweenManager(this);this.input=new Phaser.Input(this);this.sound=new Phaser.SoundManager(this);this.physics=new Phaser.Physics.Arcade(this);this.particles=new Phaser.Particles(this);this.plugins=new Phaser.PluginManager(this,this);this.net=new Phaser.Net(this);this.debug=new Phaser.Utils.Debug(this);this.load.onLoadComplete.add(this.loadComplete,this);this.stage.boot();this.world.boot();this.state.boot();this.input.boot();this.sound.boot();if(this.renderType==Phaser.CANVAS){console.log("%cPhaser "+Phaser.VERSION+" initialized. Rendering to Canvas","color: #ffff33; background: #000000")}else{console.log("%cPhaser "+Phaser.VERSION+" initialized. Rendering to WebGL","color: #ffff33; background: #000000")}this.isRunning=true;this._loadComplete=false;this.raf=new Phaser.RequestAnimationFrame(this);this.raf.start()}},setUpRenderer:function(){if(this.renderType===Phaser.CANVAS||(this.renderType===Phaser.AUTO&&this.device.webGL==false)){if(this.device.canvas){this.renderType=Phaser.CANVAS;this.renderer=new PIXI.CanvasRenderer(this.width,this.height,this.stage.canvas,this.transparent);Phaser.Canvas.setSmoothingEnabled(this.renderer.context,this.antialias);this.canvas=this.renderer.view;this.context=this.renderer.context}else{throw new Error("Phaser.Game - cannot create Canvas or WebGL context, aborting.")}}else{this.renderType=Phaser.WEBGL;this.renderer=new PIXI.WebGLRenderer(this.width,this.height,this.stage.canvas,this.transparent,this.antialias);this.canvas=this.renderer.view;this.context=null}Phaser.Canvas.addToDOM(this.renderer.view,this.parent,true);Phaser.Canvas.setTouchAction(this.renderer.view)},loadComplete:function(){this._loadComplete=true;this.state.loadComplete()},update:function(b){this.time.update(b);if(!this._paused){this.plugins.preUpdate();this.physics.preUpdate();this.input.update();this.tweens.update();this.sound.update();this.world.update();this.particles.update();this.state.update();this.plugins.update();this.renderer.render(this.stage._stage);this.plugins.render();this.state.render();this.plugins.postRender()}},destroy:function(){this.state.destroy();this.state=null;this.cache=null;this.input=null;this.load=null;this.sound=null;this.stage=null;this.time=null;this.world=null;this.isBooted=false}};Object.defineProperty(Phaser.Game.prototype,"paused",{get:function(){return this._paused},set:function(b){if(b===true){if(this._paused==false){this._paused=true;this.onPause.dispatch(this)}}else{if(this._paused){this._paused=false;this.onResume.dispatch(this)}}}});Phaser.Input=function(b){this.game=b;this.hitCanvas=null;this.hitContext=null};Phaser.Input.MOUSE_OVERRIDES_TOUCH=0;Phaser.Input.TOUCH_OVERRIDES_MOUSE=1;Phaser.Input.MOUSE_TOUCH_COMBINE=2;Phaser.Input.prototype={game:null,pollRate:0,_pollCounter:0,_oldPosition:null,_x:0,_y:0,disabled:false,multiInputOverride:Phaser.Input.MOUSE_TOUCH_COMBINE,position:null,speed:null,circle:null,scale:null,maxPointers:10,currentPointers:0,tapRate:200,doubleTapRate:300,holdRate:2000,justPressedRate:200,justReleasedRate:200,recordPointerHistory:false,recordRate:100,recordLimit:100,pointer1:null,pointer2:null,pointer3:null,pointer4:null,pointer5:null,pointer6:null,pointer7:null,pointer8:null,pointer9:null,pointer10:null,activePointer:null,mousePointer:null,mouse:null,keyboard:null,touch:null,mspointer:null,onDown:null,onUp:null,onTap:null,onHold:null,interactiveItems:new Phaser.LinkedList(),boot:function(){this.mousePointer=new Phaser.Pointer(this.game,0);this.pointer1=new Phaser.Pointer(this.game,1);this.pointer2=new Phaser.Pointer(this.game,2);this.mouse=new Phaser.Mouse(this.game);this.keyboard=new Phaser.Keyboard(this.game);this.touch=new Phaser.Touch(this.game);this.mspointer=new Phaser.MSPointer(this.game);this.onDown=new Phaser.Signal();this.onUp=new Phaser.Signal();this.onTap=new Phaser.Signal();this.onHold=new Phaser.Signal();this.scale=new Phaser.Point(1,1);this.speed=new Phaser.Point();this.position=new Phaser.Point();this._oldPosition=new Phaser.Point();this.circle=new Phaser.Circle(0,0,44);this.activePointer=this.mousePointer;this.currentPointers=0;this.hitCanvas=document.createElement("canvas");this.hitCanvas.width=1;this.hitCanvas.height=1;this.hitContext=this.hitCanvas.getContext("2d");this.mouse.start();this.keyboard.start();this.touch.start();this.mspointer.start();this.mousePointer.active=true},addPointer:function(){var c=0;for(var b=10;b>0;b--){if(this["pointer"+b]===null){c=b}}if(c==0){console.warn("You can only have 10 Pointer objects");return null}else{this["pointer"+c]=new Phaser.Pointer(this.game,c);return this["pointer"+c]}},update:function(){if(this.pollRate>0&&this._pollCounter 0&&this._pollCounter =this.game.input.holdRate){if(this.game.input.multiInputOverride==Phaser.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==Phaser.Input.MOUSE_TOUCH_COMBINE||(this.game.input.multiInputOverride==Phaser.Input.TOUCH_OVERRIDES_MOUSE&&this.game.input.currentPointers==0)){this.game.input.onHold.dispatch(this)}this._holdSent=true}if(this.game.input.recordPointerHistory&&this.game.time.now>=this._nextDrop){this._nextDrop=this.game.time.now+this.game.input.recordRate;this._history.push({x:this.position.x,y:this.position.y});if(this._history.length>this.game.input.recordLimit){this._history.shift()}}}},move:function(c){if(this.game.input.pollLocked){return}if(c.button){this.button=c.button}this.clientX=c.clientX;this.clientY=c.clientY;this.pageX=c.pageX;this.pageY=c.pageY;this.screenX=c.screenX;this.screenY=c.screenY;this.x=(this.pageX-this.game.stage.offset.x)*this.game.input.scale.x;this.y=(this.pageY-this.game.stage.offset.y)*this.game.input.scale.y;this.position.setTo(this.x,this.y);this.circle.x=this.x;this.circle.y=this.y;if(this.game.input.multiInputOverride==Phaser.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==Phaser.Input.MOUSE_TOUCH_COMBINE||(this.game.input.multiInputOverride==Phaser.Input.TOUCH_OVERRIDES_MOUSE&&this.game.input.currentPointers==0)){this.game.input.activePointer=this;this.game.input.x=this.x;this.game.input.y=this.y;this.game.input.position.setTo(this.game.input.x,this.game.input.y);this.game.input.circle.x=this.game.input.x;this.game.input.circle.y=this.game.input.y}if(this.game.paused){return this}if(this.targetObject!==null&&this.targetObject.isDragged==true){if(this.targetObject.update(this)==false){this.targetObject=null}return this}this._highestRenderOrderID=-1;this._highestRenderObject=null;this._highestInputPriorityID=-1;if(this.game.input.interactiveItems.total>0){var b=this.game.input.interactiveItems.next;do{if(b.priorityID>this._highestInputPriorityID||(b.priorityID==this._highestInputPriorityID&&b.sprite.renderOrderID>this._highestRenderOrderID)){if(b.checkPointerOver(this)){this._highestRenderOrderID=b.sprite.renderOrderID;this._highestInputPriorityID=b.priorityID;this._highestRenderObject=b}}b=b.next}while(b!=null)}if(this._highestRenderObject==null){if(this.targetObject){this.targetObject._pointerOutHandler(this);this.targetObject=null}}else{if(this.targetObject==null){this.targetObject=this._highestRenderObject;this._highestRenderObject._pointerOverHandler(this)}else{if(this.targetObject==this._highestRenderObject){if(this._highestRenderObject.update(this)==false){this.targetObject=null}}else{this.targetObject._pointerOutHandler(this);this.targetObject=this._highestRenderObject;this.targetObject._pointerOverHandler(this)}}}return this},leave:function(b){this.withinGame=false;this.move(b)},stop:function(c){if(this._stateReset){c.preventDefault();return}this.timeUp=this.game.time.now;if(this.game.input.multiInputOverride==Phaser.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==Phaser.Input.MOUSE_TOUCH_COMBINE||(this.game.input.multiInputOverride==Phaser.Input.TOUCH_OVERRIDES_MOUSE&&this.game.input.currentPointers==0)){this.game.input.onUp.dispatch(this);if(this.duration>=0&&this.duration<=this.game.input.tapRate){if(this.timeUp-this.previousTapTime 0){this.active=false}this.withinGame=false;this.isDown=false;this.isUp=true;if(this.isMouse==false){this.game.input.currentPointers--}if(this.game.input.interactiveItems.total>0){var b=this.game.input.interactiveItems.next;do{if(b){b._releasedHandler(this)}b=b.next}while(b!=null)}if(this.targetObject){this.targetObject._releasedHandler(this)}this.targetObject=null;return this},justPressed:function(b){b=b||this.game.input.justPressedRate;return(this.isDown===true&&(this.timeDown+b)>this.game.time.now)},justReleased:function(b){b=b||this.game.input.justReleasedRate;return(this.isUp===true&&(this.timeUp+b)>this.game.time.now)},reset:function(){if(this.isMouse==false){this.active=false}this.identifier=null;this.isDown=false;this.isUp=true;this.totalTouches=0;this._holdSent=false;this._history.length=0;this._stateReset=true;if(this.targetObject){this.targetObject._releasedHandler(this)}this.targetObject=null},toString:function(){return"[{Pointer (id="+this.id+" identifer="+this.identifier+" active="+this.active+" duration="+this.duration+" withinGame="+this.withinGame+" x="+this.x+" y="+this.y+" clientX="+this.clientX+" clientY="+this.clientY+" screenX="+this.screenX+" screenY="+this.screenY+" pageX="+this.pageX+" pageY="+this.pageY+")}]"}};Object.defineProperty(Phaser.Pointer.prototype,"duration",{get:function(){if(this.isUp){return -1}return this.game.time.now-this.timeDown}});Object.defineProperty(Phaser.Pointer.prototype,"worldX",{get:function(){return this.game.world.camera.x+this.x}});Object.defineProperty(Phaser.Pointer.prototype,"worldY",{get:function(){return this.game.world.camera.y+this.y}});Phaser.Touch=function(b){this.game=b;this.callbackContext=this.game;this.touchStartCallback=null;this.touchMoveCallback=null;this.touchEndCallback=null;this.touchEnterCallback=null;this.touchLeaveCallback=null;this.touchCancelCallback=null;this.preventDefault=true};Phaser.Touch.prototype={game:null,disabled:false,_onTouchStart:null,_onTouchMove:null,_onTouchEnd:null,_onTouchEnter:null,_onTouchLeave:null,_onTouchCancel:null,_onTouchMove:null,start:function(){var b=this;if(this.game.device.touch){this._onTouchStart=function(c){return b.onTouchStart(c)};this._onTouchMove=function(c){return b.onTouchMove(c)};this._onTouchEnd=function(c){return b.onTouchEnd(c)};this._onTouchEnter=function(c){return b.onTouchEnter(c)};this._onTouchLeave=function(c){return b.onTouchLeave(c)};this._onTouchCancel=function(c){return b.onTouchCancel(c)};this.game.renderer.view.addEventListener("touchstart",this._onTouchStart,false);this.game.renderer.view.addEventListener("touchmove",this._onTouchMove,false);this.game.renderer.view.addEventListener("touchend",this._onTouchEnd,false);this.game.renderer.view.addEventListener("touchenter",this._onTouchEnter,false);this.game.renderer.view.addEventListener("touchleave",this._onTouchLeave,false);this.game.renderer.view.addEventListener("touchcancel",this._onTouchCancel,false)}},consumeDocumentTouches:function(){this._documentTouchMove=function(b){b.preventDefault()};document.addEventListener("touchmove",this._documentTouchMove,false)},onTouchStart:function(c){if(this.touchStartCallback){this.touchStartCallback.call(this.callbackContext,c)}if(this.game.input.disabled||this.disabled){return}if(this.preventDefault){c.preventDefault()}for(var b=0;b b&&this._tempPoint.xc&&this._tempPoint.y =this.pixelPerfectAlpha){return true}}return false},update:function(b){if(this.enabled==false||this.sprite.visible==false){this._pointerOutHandler(b);return false}if(this.draggable&&this._draggedPointerID==b.id){return this.updateDrag(b)}else{if(this._pointerData[b.id].isOver==true){if(this.checkPointerOver(b)){this._pointerData[b.id].x=b.x-this.sprite.x;this._pointerData[b.id].y=b.y-this.sprite.y;return true}else{this._pointerOutHandler(b);return false}}}},_pointerOverHandler:function(b){if(this._pointerData[b.id].isOver==false){this._pointerData[b.id].isOver=true;this._pointerData[b.id].isOut=false;this._pointerData[b.id].timeOver=this.game.time.now;this._pointerData[b.id].x=b.x-this.sprite.x;this._pointerData[b.id].y=b.y-this.sprite.y;if(this.useHandCursor&&this._pointerData[b.id].isDragged==false){this.game.stage.canvas.style.cursor="pointer"}this.sprite.events.onInputOver.dispatch(this.sprite,b)}},_pointerOutHandler:function(b){this._pointerData[b.id].isOver=false;this._pointerData[b.id].isOut=true;this._pointerData[b.id].timeOut=this.game.time.now;if(this.useHandCursor&&this._pointerData[b.id].isDragged==false){this.game.stage.canvas.style.cursor="default"}this.sprite.events.onInputOut.dispatch(this.sprite,b)},_touchedHandler:function(b){if(this._pointerData[b.id].isDown==false&&this._pointerData[b.id].isOver==true){this._pointerData[b.id].isDown=true;this._pointerData[b.id].isUp=false;this._pointerData[b.id].timeDown=this.game.time.now;this.sprite.events.onInputDown.dispatch(this.sprite,b);if(this.draggable&&this.isDragged==false){this.startDrag(b)}if(this.bringToTop){this.sprite.bringToTop()}}return this.consumePointerEvent},_releasedHandler:function(b){if(this._pointerData[b.id].isDown&&b.isUp){this._pointerData[b.id].isDown=false;this._pointerData[b.id].isUp=true;this._pointerData[b.id].timeUp=this.game.time.now;this._pointerData[b.id].downDuration=this._pointerData[b.id].timeUp-this._pointerData[b.id].timeDown;if(this.checkPointerOver(b)){this.sprite.events.onInputUp.dispatch(this.sprite,b)}else{if(this.useHandCursor){this.game.stage.canvas.style.cursor="default"}}if(this.draggable&&this.isDragged&&this._draggedPointerID==b.id){this.stopDrag(b)}}},updateDrag:function(b){if(b.isUp){this.stopDrag(b);return false}if(this.allowHorizontalDrag){this.sprite.x=b.x+this._dragPoint.x+this.dragOffset.x}if(this.allowVerticalDrag){this.sprite.y=b.y+this._dragPoint.y+this.dragOffset.y}if(this.boundsRect){this.checkBoundsRect()}if(this.boundsSprite){this.checkBoundsSprite()}if(this.snapOnDrag){this.sprite.x=Math.floor(this.sprite.x/this.snapX)*this.snapX;this.sprite.y=Math.floor(this.sprite.y/this.snapY)*this.snapY}return true},justOver:function(c,b){c=c||0;b=b||500;return(this._pointerData[c].isOver&&this.overDuration(c)this.boundsRect.right){this.sprite.x=this.boundsRect.right-this.sprite.width}}if(this.sprite.y this.boundsRect.bottom){this.sprite.y=this.boundsRect.bottom-this.sprite.height}}},checkBoundsSprite:function(){if(this.sprite.x (this.boundsSprite.x+this.boundsSprite.width)){this.sprite.x=(this.boundsSprite.x+this.boundsSprite.width)-this.sprite.width}}if(this.sprite.y (this.boundsSprite.y+this.boundsSprite.height)){this.sprite.y=(this.boundsSprite.y+this.boundsSprite.height)-this.sprite.height}}}};Phaser.Canvas={create:function(d,b){d=d||256;b=b||256;var c=document.createElement("canvas");c.width=d;c.height=b;c.style.display="block";return c},getOffset:function(c,b){b=b||new Phaser.Point;var d=c.getBoundingClientRect();var h=c.clientTop||document.body.clientTop||0;var g=c.clientLeft||document.body.clientLeft||0;var e=window.pageYOffset||c.scrollTop||document.body.scrollTop;var f=window.pageXOffset||c.scrollLeft||document.body.scrollLeft;b.x=d.left+f-g;b.y=d.top+e-h;return b},getAspectRatio:function(b){return b.width/b.height},setBackgroundColor:function(c,b){b=b||"rgb(0,0,0)";c.style.backgroundColor=b;return c},setTouchAction:function(b,c){c=c||"none";b.style.msTouchAction=c;b.style["ms-touch-action"]=c;b.style["touch-action"]=c;return b},addToDOM:function(b,c,d){c=c||"";d=d||true;if(c!==""){if(document.getElementById(c)){document.getElementById(c).appendChild(b)}else{document.body.appendChild(b)}if(d){document.getElementById(c).style.overflow="hidden"}}else{document.body.appendChild(b)}return b},setTransform:function(f,h,g,d,b,e,c){f.setTransform(d,e,c,b,h,g);return f},setSmoothingEnabled:function(b,c){b.imageSmoothingEnabled=c;b.mozImageSmoothingEnabled=c;b.oImageSmoothingEnabled=c;b.webkitImageSmoothingEnabled=c;b.msImageSmoothingEnabled=c;return b},setImageRenderingCrisp:function(b){b.style["image-rendering"]="crisp-edges";b.style["image-rendering"]="-moz-crisp-edges";b.style["image-rendering"]="-webkit-optimize-contrast";b.style.msInterpolationMode="nearest-neighbor";return b},setImageRenderingBicubic:function(b){b.style["image-rendering"]="auto";b.style.msInterpolationMode="bicubic";return b}};Phaser.Events=function(b){this.parent=b;this.onAddedToGroup=new Phaser.Signal;this.onRemovedFromGroup=new Phaser.Signal;this.onKilled=new Phaser.Signal;this.onRevived=new Phaser.Signal;this.onOutOfBounds=new Phaser.Signal;this.onInputOver=null;this.onInputOut=null;this.onInputDown=null;this.onInputUp=null;this.onDragStart=null;this.onDragStop=null;this.onAnimationStart=null;this.onAnimationComplete=null;this.onAnimationLoop=null};Phaser.GameObjectFactory=function(b){this.game=b;this.world=this.game.world};Phaser.GameObjectFactory.prototype={game:null,world:null,existing:function(b){return this.world.group.add(b)},sprite:function(b,e,c,d){return this.world.group.add(new Phaser.Sprite(this.game,b,e,c,d))},child:function(d,b,g,c,e){var f=this.world.group.add(new Phaser.Sprite(this.game,b,g,c,e));d.addChild(f);return f},tween:function(b){return this.game.tweens.create(b)},group:function(c,b){return new Phaser.Group(this.game,c,b)},audio:function(c,d,b){return this.game.sound.add(c,d,b)},tileSprite:function(c,g,e,b,d,f){return this.world.group.add(new Phaser.TileSprite(this.game,c,g,e,b,d,f))},text:function(b,e,d,c){return this.world.group.add(new Phaser.Text(this.game,b,e,d,c))},button:function(b,i,g,h,e,d,f,c){return this.world.group.add(new Phaser.Button(this.game,b,i,g,h,e,d,f,c))},graphics:function(b,c){return this.world.group.add(new Phaser.Graphics(this.game,b,c))},emitter:function(b,d,c){return this.game.particles.add(new Phaser.Particles.Arcade.Emitter(this.game,b,d,c))},bitmapText:function(b,e,d,c){return this.world.group.add(new Phaser.BitmapText(this.game,b,e,d,c))},tilemap:function(b,g,d,e,f,c){return this.world.group.add(new Phaser.Tilemap(this.game,d,b,g,e,f,c))},renderTexture:function(c,d,b){var e=new Phaser.RenderTexture(this.game,c,d,b);this.game.cache.addRenderTexture(c,e);return e}};Phaser.Sprite=function(c,b,f,d,e){b=b||0;f=f||0;d=d||null;e=e||null;this.game=c;this.exists=true;this.alive=true;this.group=null;this.name="";this.type=Phaser.SPRITE;this.renderOrderID=-1;this.lifespan=0;this.events=new Phaser.Events(this);this.animations=new Phaser.AnimationManager(this);this.input=new Phaser.InputHandler(this);this.key=d;if(d instanceof Phaser.RenderTexture){PIXI.Sprite.call(this,d);this.currentFrame=this.game.cache.getTextureFrame(d.name)}else{if(d==null||this.game.cache.checkImageKey(d)==false){d="__default"}PIXI.Sprite.call(this,PIXI.TextureCache[d]);if(this.game.cache.isSpriteSheet(d)){this.animations.loadFrameData(this.game.cache.getFrameData(d));if(e!==null){if(typeof e==="string"){this.frameName=e}else{this.frame=e}}}else{this.currentFrame=this.game.cache.getFrame(d)}}this.anchor=new Phaser.Point();this._cropUUID=null;this._cropRect=null;this.x=b;this.y=f;this.position.x=b;this.position.y=f;this.autoCull=false;this.scale=new Phaser.Point(1,1);this.scrollFactor=new Phaser.Point(1,1);this._cache={dirty:false,a00:1,a01:0,a02:b,a10:0,a11:1,a12:f,id:1,i01:0,i10:0,idi:1,left:null,right:null,top:null,bottom:null,x:-1,y:-1,scaleX:1,scaleY:1,width:this.currentFrame.sourceSizeW,height:this.currentFrame.sourceSizeH,halfWidth:Math.floor(this.currentFrame.sourceSizeW/2),halfHeight:Math.floor(this.currentFrame.sourceSizeH/2),frameID:this.currentFrame.uuid,frameWidth:this.currentFrame.width,frameHeight:this.currentFrame.height,boundsX:0,boundsY:0,cameraVisible:true};this.offset=new Phaser.Point;this.center=new Phaser.Point(b+Math.floor(this._cache.width/2),f+Math.floor(this._cache.height/2));this.topLeft=new Phaser.Point(b,f);this.topRight=new Phaser.Point(b+this._cache.width,f);this.bottomRight=new Phaser.Point(b+this._cache.width,f+this._cache.height);this.bottomLeft=new Phaser.Point(b,f+this._cache.height);this.bounds=new Phaser.Rectangle(b,f,this._cache.width,this._cache.height);this.body=new Phaser.Physics.Arcade.Body(this);this.velocity=this.body.velocity;this.acceleration=this.body.acceleration;this.inWorld=Phaser.Rectangle.intersects(this.bounds,this.game.world.bounds);this.inWorldThreshold=0;this._outOfBoundsFired=false};Phaser.Sprite.prototype=Object.create(PIXI.Sprite.prototype);Phaser.Sprite.prototype.constructor=Phaser.Sprite;Phaser.Sprite.prototype.preUpdate=function(){if(!this.exists){this.renderOrderID=-1;return}if(this.lifespan>0){this.lifespan-=this.game.time.elapsed;if(this.lifespan<=0){this.kill();return}}this._cache.dirty=false;if(this.animations.update()){this._cache.dirty=true}this._cache.x=this.x-(this.game.world.camera.x*this.scrollFactor.x);this._cache.y=this.y-(this.game.world.camera.y*this.scrollFactor.y);if(this.position.x!=this._cache.x||this.position.y!=this._cache.y){this.position.x=this._cache.x;this.position.y=this._cache.y;this._cache.dirty=true}if(this.visible){this.renderOrderID=this.game.world.currentRenderOrderID++;if(this.worldTransform[0]!=this._cache.a00||this.worldTransform[1]!=this._cache.a01){this._cache.a00=this.worldTransform[0];this._cache.a01=this.worldTransform[1];this._cache.i01=this.worldTransform[1];this._cache.scaleX=Math.sqrt((this._cache.a00*this._cache.a00)+(this._cache.a01*this._cache.a01));this._cache.a01*=-1;this._cache.dirty=true}if(this.worldTransform[3]!=this._cache.a10||this.worldTransform[4]!=this._cache.a11){this._cache.a10=this.worldTransform[3];this._cache.i10=this.worldTransform[3];this._cache.a11=this.worldTransform[4];this._cache.scaleY=Math.sqrt((this._cache.a10*this._cache.a10)+(this._cache.a11*this._cache.a11));this._cache.a10*=-1;this._cache.dirty=true}if(this.worldTransform[2]!=this._cache.a02||this.worldTransform[5]!=this._cache.a12){this._cache.a02=this.worldTransform[2];this._cache.a12=this.worldTransform[5];this._cache.dirty=true}if(this.currentFrame.uuid!=this._cache.frameID){this._cache.frameWidth=this.texture.frame.width;this._cache.frameHeight=this.texture.frame.height;this._cache.frameID=this.currentFrame.uuid;this._cache.dirty=true}if(this._cache.dirty){this._cache.width=Math.floor(this.currentFrame.sourceSizeW*this._cache.scaleX);this._cache.height=Math.floor(this.currentFrame.sourceSizeH*this._cache.scaleY);this._cache.halfWidth=Math.floor(this._cache.width/2);this._cache.halfHeight=Math.floor(this._cache.height/2);this._cache.id=1/(this._cache.a00*this._cache.a11+this._cache.a01*-this._cache.a10);this._cache.idi=1/(this._cache.a00*this._cache.a11+this._cache.i01*-this._cache.i10);this.updateBounds()}}else{if(this._cache.dirty&&this.visible==false){this.bounds.x-=this._cache.boundsX-this._cache.x;this._cache.boundsX=this._cache.x;this.bounds.y-=this._cache.boundsy-this._cache.y;this._cache.boundsY=this._cache.y}}if(this._cache.dirty){this._cache.cameraVisible=Phaser.Rectangle.intersects(this.game.world.camera.screenView,this.bounds,0);if(this.autoCull==true){this.visible=this._cache.cameraVisible}this.body.updateBounds(this.center.x,this.center.y,this._cache.scaleX,this._cache.scaleY)}this.body.update()};Phaser.Sprite.prototype.revive=function(){this.alive=true;this.exists=true;this.visible=true;this.events.onRevived.dispatch(this)};Phaser.Sprite.prototype.kill=function(){this.alive=false;this.exists=false;this.visible=false;this.events.onKilled.dispatch(this)};Phaser.Sprite.prototype.reset=function(b,c){this.x=b;this.y=c;this.position.x=b;this.position.y=c;this.alive=true;this.exists=true;this.visible=true;this._outOfBoundsFired=false;this.body.reset()};Phaser.Sprite.prototype.updateBounds=function(){this.offset.setTo(this._cache.a02-(this.anchor.x*this._cache.width),this._cache.a12-(this.anchor.y*this._cache.height));this.getLocalPosition(this.center,this.offset.x+this._cache.halfWidth,this.offset.y+this._cache.halfHeight);this.getLocalPosition(this.topLeft,this.offset.x,this.offset.y);this.getLocalPosition(this.topRight,this.offset.x+this._cache.width,this.offset.y);this.getLocalPosition(this.bottomLeft,this.offset.x,this.offset.y+this._cache.height);this.getLocalPosition(this.bottomRight,this.offset.x+this._cache.width,this.offset.y+this._cache.height);this._cache.left=Phaser.Math.min(this.topLeft.x,this.topRight.x,this.bottomLeft.x,this.bottomRight.x);this._cache.right=Phaser.Math.max(this.topLeft.x,this.topRight.x,this.bottomLeft.x,this.bottomRight.x);this._cache.top=Phaser.Math.min(this.topLeft.y,this.topRight.y,this.bottomLeft.y,this.bottomRight.y);this._cache.bottom=Phaser.Math.max(this.topLeft.y,this.topRight.y,this.bottomLeft.y,this.bottomRight.y);this.bounds.setTo(this._cache.left,this._cache.top,this._cache.right-this._cache.left,this._cache.bottom-this._cache.top);this._cache.boundsX=this._cache.x;this._cache.boundsY=this._cache.y;if(this.inWorld==false){this.inWorld=Phaser.Rectangle.intersects(this.bounds,this.game.world.bounds,this.inWorldThreshold);if(this.inWorld){this._outOfBoundsFired=false}}else{this.inWorld=Phaser.Rectangle.intersects(this.bounds,this.game.world.bounds,this.inWorldThreshold);if(this.inWorld==false){this.events.onOutOfBounds.dispatch(this);this._outOfBoundsFired=true}}};Phaser.Sprite.prototype.getLocalPosition=function(c,b,d){c.x=((this._cache.a11*this._cache.id*b+-this._cache.a01*this._cache.id*d+(this._cache.a12*this._cache.a01-this._cache.a02*this._cache.a11)*this._cache.id)*this._cache.scaleX)+this._cache.a02;c.y=((this._cache.a00*this._cache.id*d+-this._cache.a10*this._cache.id*b+(-this._cache.a12*this._cache.a00+this._cache.a02*this._cache.a10)*this._cache.id)*this._cache.scaleY)+this._cache.a12;return c};Phaser.Sprite.prototype.getLocalUnmodifiedPosition=function(c,b,d){c.x=this._cache.a11*this._cache.idi*b+-this._cache.i01*this._cache.idi*d+(this._cache.a12*this._cache.i01-this._cache.a02*this._cache.a11)*this._cache.idi;c.y=this._cache.a00*this._cache.idi*d+-this._cache.i10*this._cache.idi*b+(-this._cache.a12*this._cache.a00+this._cache.a02*this._cache.i10)*this._cache.idi;return c};Phaser.Sprite.prototype.bringToTop=function(){if(this.group){this.group.bringToTop(this)}else{this.game.world.bringToTop(this)}};Phaser.Sprite.prototype.getBounds=function(d){d=d||new Phaser.Rectangle;var f=Phaser.Math.min(this.topLeft.x,this.topRight.x,this.bottomLeft.x,this.bottomRight.x);var c=Phaser.Math.max(this.topLeft.x,this.topRight.x,this.bottomLeft.x,this.bottomRight.x);var e=Phaser.Math.min(this.topLeft.y,this.topRight.y,this.bottomLeft.y,this.bottomRight.y);var b=Phaser.Math.max(this.topLeft.y,this.topRight.y,this.bottomLeft.y,this.bottomRight.y);d.x=f;d.y=e;d.width=c-f;d.height=b-e;return d};Object.defineProperty(Phaser.Sprite.prototype,"angle",{get:function(){return Phaser.Math.radToDeg(this.rotation)},set:function(b){this.rotation=Phaser.Math.degToRad(b)}});Object.defineProperty(Phaser.Sprite.prototype,"frame",{get:function(){return this.animations.frame},set:function(b){this.animations.frame=b}});Object.defineProperty(Phaser.Sprite.prototype,"frameName",{get:function(){return this.animations.frameName},set:function(b){this.animations.frameName=b}});Object.defineProperty(Phaser.Sprite.prototype,"inCamera",{get:function(){return this._cache.cameraVisible}});Object.defineProperty(Phaser.Sprite.prototype,"crop",{get:function(){return this._cropRect},set:function(b){if(b instanceof Phaser.Rectangle){if(this._cropUUID==null){this._cropUUID=this.game.rnd.uuid();PIXI.TextureCache[this._cropUUID]=new PIXI.Texture(PIXI.BaseTextureCache[this.key],{x:b.x,y:b.y,width:b.width,height:b.height})}else{PIXI.TextureCache[this._cropUUID].frame=b}this._cropRect=b;this.setTexture(PIXI.TextureCache[this._cropUUID])}}});Object.defineProperty(Phaser.Sprite.prototype,"inputEnabled",{get:function(){return(this.input.enabled)},set:function(b){if(b){if(this.input.enabled==false){this.input.start()}}else{if(this.input.enabled){this.input.stop()}}}});Phaser.TileSprite=function(d,c,h,f,b,e,g){c=c||0;h=h||0;f=f||256;b=b||256;e=e||null;g=g||null;Phaser.Sprite.call(this,d,c,h,e,g);this.texture=PIXI.TextureCache[e];PIXI.TilingSprite.call(this,this.texture,f,b);this.type=Phaser.TILESPRITE;this.tileScale=new Phaser.Point(1,1);this.tilePosition=new Phaser.Point(0,0)};Phaser.TileSprite.prototype=Phaser.Utils.extend(true,PIXI.TilingSprite.prototype,Phaser.Sprite.prototype);Phaser.TileSprite.prototype.constructor=Phaser.TileSprite;Phaser.Text=function(c,b,g,f,d){b=b||0;g=g||0;f=f||"";d=d||"";this.canvas=document.createElement("canvas");this.context=this.canvas.getContext("2d");var e=c.rnd.uuid();PIXI.TextureCache[e]=new PIXI.Texture(new PIXI.BaseTexture(this.canvas));Phaser.Sprite.call(this,c,b,g,e);this.type=Phaser.TEXT;this.setText(f);this.setStyle(d);this.updateText();this.dirty=false};Phaser.Text.prototype=Phaser.Utils.extend(true,Phaser.Sprite.prototype,PIXI.Text.prototype);Phaser.Text.prototype.constructor=Phaser.Text;Phaser.Button=function(j,g,f,h,i,c,d,b,e){g=g||0;f=f||0;h=h||null;i=i||null;c=c||this;Phaser.Sprite.call(this,j,g,f,h,b);this.type=Phaser.BUTTON;this._onOverFrameName=null;this._onOutFrameName=null;this._onDownFrameName=null;this._onUpFrameName=null;this._onOverFrameID=null;this._onOutFrameID=null;this._onDownFrameID=null;this._onUpFrameID=null;this.onInputOver=new Phaser.Signal;this.onInputOut=new Phaser.Signal;this.onInputDown=new Phaser.Signal;this.onInputUp=new Phaser.Signal;this.setFrames(d,b,e);if(i!==null){this.onInputUp.add(i,c)}this.input.start(0,false,true);this.events.onInputOver.add(this.onInputOverHandler,this);this.events.onInputOut.add(this.onInputOutHandler,this);this.events.onInputDown.add(this.onInputDownHandler,this);this.events.onInputUp.add(this.onInputUpHandler,this)};Phaser.Button.prototype=Phaser.Utils.extend(true,Phaser.Sprite.prototype,PIXI.Sprite.prototype);Phaser.Button.prototype.constructor=Phaser.Button;Phaser.Button.prototype.setFrames=function(c,d,b){if(c!==null){if(typeof c==="string"){this._onOverFrameName=c}else{this._onOverFrameID=c}}if(d!==null){if(typeof d==="string"){this._onOutFrameName=d;this._onUpFrameName=d}else{this._onOutFrameID=d;this._onUpFrameID=d}}if(b!==null){if(typeof b==="string"){this._onDownFrameName=b}else{this._onDownFrameID=b}}};Phaser.Button.prototype.onInputOverHandler=function(b){if(this._onOverFrameName!=null){this.frameName=this._onOverFrameName}else{if(this._onOverFrameID!=null){this.frame=this._onOverFrameID}}if(this.onInputOver){this.onInputOver.dispatch(this,b)}};Phaser.Button.prototype.onInputOutHandler=function(b){if(this._onOutFrameName!=null){this.frameName=this._onOutFrameName}else{if(this._onOutFrameID!=null){this.frame=this._onOutFrameID}}if(this.onInputOut){this.onInputOut.dispatch(this,b)}};Phaser.Button.prototype.onInputDownHandler=function(b){if(this._onDownFrameName!=null){this.frameName=this._onDownFrameName}else{if(this._onDownFrameID!=null){this.frame=this._onDownFrameID}}if(this.onInputDown){this.onInputDown.dispatch(this,b)}};Phaser.Button.prototype.onInputUpHandler=function(b){if(this._onUpFrameName!=null){this.frameName=this._onUpFrameName}else{if(this._onUpFrameID!=null){this.frame=this._onUpFrameID}}if(this.onInputUp){this.onInputUp.dispatch(this,b)}};Phaser.Graphics=function(c,b,d){this.exists=true;this.alive=true;this.group=null;this.name="";this.game=c;PIXI.DisplayObjectContainer.call(this);this.type=Phaser.GRAPHICS;this.position.x=b;this.position.y=d;this.scale=new Phaser.Point(1,1);this.scrollFactor=new Phaser.Point(1,1);this._cache={dirty:false,a00:1,a01:0,a02:b,a10:0,a11:1,a12:d,id:1,x:-1,y:-1,scaleX:1,scaleY:1};this._cache.x=this.x-(this.game.world.camera.x*this.scrollFactor.x);this._cache.y=this.y-(this.game.world.camera.y*this.scrollFactor.y);this.renderable=true;this.fillAlpha=1;this.lineWidth=0;this.lineColor="black";this.graphicsData=[];this.currentPath={points:[]}};Phaser.Graphics.prototype=Phaser.Utils.extend(true,PIXI.Graphics.prototype,PIXI.DisplayObjectContainer.prototype,Phaser.Sprite.prototype);Phaser.Graphics.prototype.constructor=Phaser.Graphics;Phaser.Graphics.prototype.update=function(){if(!this.exists){return}this._cache.dirty=false;this._cache.x=this.x-(this.game.world.camera.x*this.scrollFactor.x);this._cache.y=this.y-(this.game.world.camera.y*this.scrollFactor.y);if(this.position.x!=this._cache.x||this.position.y!=this._cache.y){this.position.x=this._cache.x;this.position.y=this._cache.y;this._cache.dirty=true}};Object.defineProperty(Phaser.Graphics.prototype,"angle",{get:function(){return Phaser.Math.radToDeg(this.rotation)},set:function(b){this.rotation=Phaser.Math.degToRad(b)}});Object.defineProperty(Phaser.Graphics.prototype,"x",{get:function(){return this.position.x},set:function(b){this.position.x=b}});Object.defineProperty(Phaser.Graphics.prototype,"y",{get:function(){return this.position.y},set:function(b){this.position.y=b}});Phaser.RenderTexture=function(c,d,e,b){this.game=c;this.name=d;PIXI.EventTarget.call(this);this.width=e||100;this.height=b||100;this.indetityMatrix=PIXI.mat3.create();this.frame=new PIXI.Rectangle(0,0,this.width,this.height);this.type=Phaser.RENDERTEXTURE;if(PIXI.gl){this.initWebGL()}else{this.initCanvas()}};Phaser.RenderTexture.prototype=Phaser.Utils.extend(true,PIXI.RenderTexture.prototype);Phaser.RenderTexture.prototype.constructor=Phaser.RenderTexture;Phaser.BitmapText=function(c,b,f,e,d){b=b||0;f=f||0;e=e||"";d=d||"";this.exists=true;this.alive=true;this.group=null;this.name="";this.game=c;PIXI.BitmapText.call(this,e,d);this.position.x=b;this.position.y=f;this.scale=new Phaser.Point(1,1);this.scrollFactor=new Phaser.Point(1,1);this._cache={dirty:false,a00:1,a01:0,a02:b,a10:0,a11:1,a12:f,id:1,x:-1,y:-1,scaleX:1,scaleY:1};this._cache.x=this.x-(this.game.world.camera.x*this.scrollFactor.x);this._cache.y=this.y-(this.game.world.camera.y*this.scrollFactor.y);this.renderable=true};Phaser.BitmapText.prototype=Phaser.Utils.extend(true,PIXI.BitmapText.prototype);Phaser.BitmapText.prototype.constructor=Phaser.BitmapText;Phaser.BitmapText.prototype.update=function(){if(!this.exists){return}this._cache.dirty=false;this._cache.x=this.x-(this.game.world.camera.x*this.scrollFactor.x);this._cache.y=this.y-(this.game.world.camera.y*this.scrollFactor.y);if(this.position.x!=this._cache.x||this.position.y!=this._cache.y){this.position.x=this._cache.x;this.position.y=this._cache.y;this._cache.dirty=true}};Object.defineProperty(Phaser.BitmapText.prototype,"angle",{get:function(){return Phaser.Math.radToDeg(this.rotation)},set:function(b){this.rotation=Phaser.Math.degToRad(b)}});Object.defineProperty(Phaser.BitmapText.prototype,"x",{get:function(){return this.position.x},set:function(b){this.position.x=b}});Object.defineProperty(Phaser.BitmapText.prototype,"y",{get:function(){return this.position.y},set:function(b){this.position.y=b}});Phaser.Canvas={create:function(d,b){d=d||256;b=b||256;var c=document.createElement("canvas");c.width=d;c.height=b;c.style.display="block";return c},getOffset:function(c,b){b=b||new Phaser.Point;var d=c.getBoundingClientRect();var h=c.clientTop||document.body.clientTop||0;var g=c.clientLeft||document.body.clientLeft||0;var e=window.pageYOffset||c.scrollTop||document.body.scrollTop;var f=window.pageXOffset||c.scrollLeft||document.body.scrollLeft;b.x=d.left+f-g;b.y=d.top+e-h;return b},getAspectRatio:function(b){return b.width/b.height},setBackgroundColor:function(c,b){b=b||"rgb(0,0,0)";c.style.backgroundColor=b;return c},setTouchAction:function(b,c){c=c||"none";b.style.msTouchAction=c;b.style["ms-touch-action"]=c;b.style["touch-action"]=c;return b},addToDOM:function(b,c,d){c=c||"";d=d||true;if(c!==""){if(document.getElementById(c)){document.getElementById(c).appendChild(b)}else{document.body.appendChild(b)}if(d){document.getElementById(c).style.overflow="hidden"}}else{document.body.appendChild(b)}return b},setTransform:function(f,h,g,d,b,e,c){f.setTransform(d,e,c,b,h,g);return f},setSmoothingEnabled:function(b,c){b.imageSmoothingEnabled=c;b.mozImageSmoothingEnabled=c;b.oImageSmoothingEnabled=c;b.webkitImageSmoothingEnabled=c;b.msImageSmoothingEnabled=c;return b},setImageRenderingCrisp:function(b){b.style["image-rendering"]="crisp-edges";b.style["image-rendering"]="-moz-crisp-edges";b.style["image-rendering"]="-webkit-optimize-contrast";b.style.msInterpolationMode="nearest-neighbor";return b},setImageRenderingBicubic:function(b){b.style["image-rendering"]="auto";b.style.msInterpolationMode="bicubic";return b}};Phaser.StageScaleMode=function(c,d,b){this._startHeight=0;this.forceLandscape=false;this.forcePortrait=false;this.incorrectOrientation=false;this.pageAlignHorizontally=false;this.pageAlignVeritcally=false;this.minWidth=null;this.maxWidth=null;this.minHeight=null;this.maxHeight=null;this.width=0;this.height=0;this.maxIterations=5;this.game=c;this.enterLandscape=new Phaser.Signal();this.enterPortrait=new Phaser.Signal();if(window.orientation){this.orientation=window.orientation}else{if(window.outerWidth>window.outerHeight){this.orientation=90}else{this.orientation=0}}this.scaleFactor=new Phaser.Point(1,1);this.aspectRatio=0;var e=this;window.addEventListener("orientationchange",function(f){return e.checkOrientation(f)},false);window.addEventListener("resize",function(f){return e.checkResize(f)},false)};Phaser.StageScaleMode.EXACT_FIT=0;Phaser.StageScaleMode.NO_SCALE=1;Phaser.StageScaleMode.SHOW_ALL=2;Phaser.StageScaleMode.prototype={startFullScreen:function(){if(this.isFullScreen){return}var b=this.game.canvas;if(b.requestFullScreen){b.requestFullScreen()}else{if(b.mozRequestFullScreen){b.mozRequestFullScreen()}else{if(b.webkitRequestFullScreen){b.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}}}this.game.stage.canvas.style.width="100%";this.game.stage.canvas.style.height="100%"},stopFullScreen:function(){if(document.cancelFullScreen){document.cancelFullScreen()}else{if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else{if(document.webkitCancelFullScreen){document.webkitCancelFullScreen()}}}},checkOrientationState:function(){if(this.incorrectOrientation){if((this.forceLandscape&&window.innerWidth>window.innerHeight)||(this.forcePortrait&&window.innerHeight>window.innerWidth)){this.game.paused=false;this.incorrectOrientation=false;this.refresh()}}else{if((this.forceLandscape&&window.innerWidth window.outerHeight){this.orientation=90}else{this.orientation=0}if(this.isLandscape){this.enterLandscape.dispatch(this.orientation,true,false)}else{this.enterPortrait.dispatch(this.orientation,false,true)}if(this.game.stage.scaleMode!==Phaser.StageScaleMode.NO_SCALE){this.refresh()}},refresh:function(){var b=this;if(this.game.device.iPad==false&&this.game.device.webApp==false&&this.game.device.desktop==false){if(this.game.device.android&&this.game.device.chrome==false){window.scrollTo(0,1)}else{window.scrollTo(0,0)}}if(this._check==null&&this.maxIterations>0){this._iterations=this.maxIterations;this._check=window.setInterval(function(){return b.setScreenSize()},10);this.setScreenSize()}},setScreenSize:function(b){if(typeof b=="undefined"){b=false}if(this.game.device.iPad==false&&this.game.device.webApp==false&&this.game.device.desktop==false){if(this.game.device.android&&this.game.device.chrome==false){window.scrollTo(0,1)}else{window.scrollTo(0,0)}}this._iterations--;if(b||window.innerHeight>this._startHeight||this._iterations<0){document.documentElement.style.minHeight=window.innerHeight+"px";if(this.incorrectOrientation==true){this.setMaximum()}else{if(this.game.stage.scaleMode==Phaser.StageScaleMode.EXACT_FIT){this.setExactFit()}else{if(this.game.stage.scaleMode==Phaser.StageScaleMode.SHOW_ALL){this.setShowAll()}}}this.setSize();clearInterval(this._check);this._check=null}},setSize:function(){if(this.incorrectOrientation==false){if(this.maxWidth&&this.width>this.maxWidth){this.width=this.maxWidth}if(this.maxHeight&&this.height>this.maxHeight){this.height=this.maxHeight}if(this.minWidth&&this.width this.maxWidth){this.width=this.maxWidth}else{this.width=b}if(this.maxHeight&&c>this.maxHeight){this.height=this.maxHeight}else{this.height=c}console.log("setExactFit",this.width,this.height,this.game.stage.offset)}};Object.defineProperty(Phaser.StageScaleMode.prototype,"isFullScreen",{get:function(){if(document.fullscreenElement===null||document.mozFullScreenElement===null||document.webkitFullscreenElement===null){return false}return true}});Object.defineProperty(Phaser.StageScaleMode.prototype,"isPortrait",{get:function(){return this.orientation==0||this.orientation==180}});Object.defineProperty(Phaser.StageScaleMode.prototype,"isLandscape",{get:function(){return this.orientation===90||this.orientation===-90}});Phaser.Device=function(){this.patchAndroidClearRectBug=false;this.desktop=false;this.iOS=false;this.android=false;this.chromeOS=false;this.linux=false;this.macOS=false;this.windows=false;this.canvas=false;this.file=false;this.fileSystem=false;this.localStorage=false;this.webGL=false;this.worker=false;this.touch=false;this.mspointer=false;this.css3D=false;this.pointerLock=false;this.arora=false;this.chrome=false;this.epiphany=false;this.firefox=false;this.ie=false;this.ieVersion=0;this.mobileSafari=false;this.midori=false;this.opera=false;this.safari=false;this.webApp=false;this.audioData=false;this.webAudio=false;this.ogg=false;this.opus=false;this.mp3=false;this.wav=false;this.m4a=false;this.webm=false;this.iPhone=false;this.iPhone4=false;this.iPad=false;this.pixelRatio=0;this._checkAudio();this._checkBrowser();this._checkCSS3D();this._checkDevice();this._checkFeatures();this._checkOS()};Phaser.Device.prototype={_checkOS:function(){var b=navigator.userAgent;if(/Android/.test(b)){this.android=true}else{if(/CrOS/.test(b)){this.chromeOS=true}else{if(/iP[ao]d|iPhone/i.test(b)){this.iOS=true}else{if(/Linux/.test(b)){this.linux=true}else{if(/Mac OS/.test(b)){this.macOS=true}else{if(/Windows/.test(b)){this.windows=true}}}}}}if(this.windows||this.macOS||this.linux){this.desktop=true}},_checkFeatures:function(){this.canvas=!!window.CanvasRenderingContext2D;try{this.localStorage=!!localStorage.getItem}catch(b){this.localStorage=false}this.file=!!window.File&&!!window.FileReader&&!!window.FileList&&!!window.Blob;this.fileSystem=!!window.requestFileSystem;this.webGL=(function(){try{return !!window.WebGLRenderingContext&&!!document.createElement("canvas").getContext("experimental-webgl")}catch(c){return false}})();this.worker=!!window.Worker;if("ontouchstart" in document.documentElement||window.navigator.msPointerEnabled){this.touch=true}if(window.navigator.msPointerEnabled){this.mspointer=true}this.pointerLock="pointerLockElement" in document||"mozPointerLockElement" in document||"webkitPointerLockElement" in document},_checkBrowser:function(){var b=navigator.userAgent;if(/Arora/.test(b)){this.arora=true}else{if(/Chrome/.test(b)){this.chrome=true}else{if(/Epiphany/.test(b)){this.epiphany=true}else{if(/Firefox/.test(b)){this.firefox=true}else{if(/Mobile Safari/.test(b)){this.mobileSafari=true}else{if(/MSIE (\d+\.\d+);/.test(b)){this.ie=true;this.ieVersion=parseInt(RegExp.$1)}else{if(/Midori/.test(b)){this.midori=true}else{if(/Opera/.test(b)){this.opera=true}else{if(/Safari/.test(b)){this.safari=true}}}}}}}}}if(navigator.standalone){this.webApp=true}},_checkAudio:function(){this.audioData=!!(window.Audio);this.webAudio=!!(window.webkitAudioContext||window.AudioContext);var d=document.createElement("audio");var b=false;try{if(b=!!d.canPlayType){if(d.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,"")){this.ogg=true}if(d.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,"")){this.opus=true}if(d.canPlayType("audio/mpeg;").replace(/^no$/,"")){this.mp3=true}if(d.canPlayType('audio/wav; codecs="1"').replace(/^no$/,"")){this.wav=true}if(d.canPlayType("audio/x-m4a;")||d.canPlayType("audio/aac;").replace(/^no$/,"")){this.m4a=true}if(d.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")){this.webm=true}}}catch(c){}},_checkDevice:function(){this.pixelRatio=window.devicePixelRatio||1;this.iPhone=navigator.userAgent.toLowerCase().indexOf("iphone")!=-1;this.iPhone4=(this.pixelRatio==2&&this.iPhone);this.iPad=navigator.userAgent.toLowerCase().indexOf("ipad")!=-1},_checkCSS3D:function(){var d=document.createElement("p");var e;var c={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};document.body.insertBefore(d,null);for(var b in c){if(d.style[b]!==undefined){d.style[b]="translate3d(1px,1px,1px)";e=window.getComputedStyle(d).getPropertyValue(c[b])}}document.body.removeChild(d);this.css3D=(e!==undefined&&e.length>0&&e!=="none")},canPlayAudio:function(b){if(b=="mp3"&&this.mp3){return true}else{if(b=="ogg"&&(this.ogg||this.opus)){return true}else{if(b=="m4a"&&this.m4a){return true}else{if(b=="wav"&&this.wav){return true}else{if(b=="webm"&&this.webm){return true}}}}}return false},isConsoleOpen:function(){if(window.console&&window.console.firebug){return true}if(window.console){console.profile();console.profileEnd();if(console.clear){console.clear()}return console.profiles.length>0}return false}};Phaser.RequestAnimationFrame=function(c){this.game=c;this._isSetTimeOut=false;this.isRunning=false;var d=["ms","moz","webkit","o"];for(var b=0;b >>0;c-=e;c*=e;e=c>>>0;c-=e;e+=c*4294967296}return(e>>>0)*2.3283064365386963e-10},integer:function(){return this.rnd.apply(this)*4294967296},frac:function(){return this.rnd.apply(this)+(this.rnd.apply(this)*2097152|0)*1.1102230246251565e-16},real:function(){return this.integer()+this.frac()},integerInRange:function(c,b){return Math.floor(this.realInRange(c,b))},realInRange:function(c,b){c=c||0;b=b||0;return this.frac()*(b-c)+c},normal:function(){return 1-2*this.frac()},uuid:function(){var d,c;for(c=d="";d++<36;c+=~d%5|d*3&4?(d^15?8^this.frac()*(d^20?16:4):4).toString(16):"-"){}return c},pick:function(b){return b[this.integerInRange(0,b.length)]},weightedPick:function(b){return b[~~(Math.pow(this.frac(),2)*b.length)]},timestamp:function(d,c){return this.realInRange(d||946684800000,c||1577862000000)},angle:function(){return this.integerInRange(-180,180)}};Phaser.Math={PI2:Math.PI*2,fuzzyEqual:function(d,c,e){if(typeof e==="undefined"){e=0.0001}return Math.abs(d-c) c-e},fuzzyCeil:function(b,c){if(typeof c==="undefined"){c=0.0001}return Math.ceil(b-c)},fuzzyFloor:function(b,c){if(typeof c==="undefined"){c=0.0001}return Math.floor(b+c)},average:function(){var b=[];for(var d=0;d<(arguments.length-0);d++){b[d]=arguments[d+0]}var e=0;for(var c=0;c 0)?Math.floor(b):Math.ceil(b)},shear:function(b){return b%1},snapTo:function(b,d,c){if(typeof c==="undefined"){c=0}if(d==0){return b}b-=c;b=d*Math.round(b/d);return c+b},snapToFloor:function(b,d,c){if(typeof c==="undefined"){c=0}if(d==0){return b}b-=c;b=d*Math.floor(b/d);return c+b},snapToCeil:function(b,d,c){if(typeof c==="undefined"){c=0}if(d==0){return b}b-=c;b=d*Math.ceil(b/d);return c+b},snapToInArray:function(d,c,f){if(typeof f==="undefined"){f=true}if(f){c.sort()}if(d d/2){c+=d*2}if(b<-d/2&&c>d/2){b+=d*2}return b-c},interpolateAngles:function(c,b,d,e,f){if(typeof e==="undefined"){e=true}if(typeof f==="undefined"){f=null}c=this.normalizeAngle(c,e);b=this.normalizeAngleToAnother(b,c,e);return(typeof f==="function")?f(d,c,b-c,1):this.interpolateFloat(c,b,d)},chanceRoll:function(b){if(typeof b==="undefined"){b=50}if(b<=0){return false}else{if(b>=100){return true}else{if(Math.random()*100>=b){return false}else{return true}}}},maxAdd:function(d,c,b){d+=c;if(d>b){d=b}return d},minSub:function(d,c,b){d-=c;if(d0.5)?1:-1},isOdd:function(b){return(b&1)},isEven:function(b){if(b&1){return false}else{return true}},max:function(){for(var d=1,c=0,b=arguments.length;d=-180&&c<=180){return c}b=(c+180)%360;if(b<0){b+=360}return b-180},angleLimit:function(e,d,c){var b=e;if(e>c){b=c}else{if(e 1){return this.linear(d[b],d[b-1],b-g)}return this.linear(d[e],d[e+1>b?b:e+1],g-e)},bezierInterpolation:function(e,d){var c=0;var g=e.length-1;for(var f=0;f<=g;f++){c+=Math.pow(1-d,g-f)*Math.pow(d,f)*e[f]*this.bernstein(g,f)}return c},catmullRomInterpolation:function(d,c){var b=d.length-1;var g=b*c;var e=Math.floor(g);if(d[0]===d[b]){if(c<0){e=Math.floor(g=b*(1+c))}return this.catmullRom(d[(e-1+b)%b],d[e],d[(e+1)%b],d[(e+2)%b],g-e)}else{if(c<0){return d[0]-(this.catmullRom(d[0],d[0],d[1],d[1],-g)-d[0])}if(c>1){return d[b]-(this.catmullRom(d[b],d[b],d[b-1],d[b-1],g-b)-d[b])}return this.catmullRom(d[e?e-1:0],d[e],d[b d.length-e)){b=d.length-e}if(b>0){return d[e+Math.floor(Math.random()*b)]}}return null},floor:function(b){var c=b|0;return(b>0)?(c):((c!=b)?(c-1):(c))},ceil:function(b){var c=b|0;return(b>0)?((c!=b)?(c+1):(c)):(c)},sinCosGenerator:function(b,j,d,h){if(typeof j==="undefined"){j=1}if(typeof d==="undefined"){d=1}if(typeof h==="undefined"){h=1}var i=j;var l=d;var f=h*Math.PI/b;var e=[];var k=[];for(var g=0;g0;d--){var c=Math.floor(Math.random()*(d+1));var b=e[d];e[d]=e[c];e[c]=b}return e},distance:function(e,g,d,f){var c=e-d;var b=g-f;return Math.sqrt(c*c+b*b)},distanceRounded:function(c,e,b,d){return Math.round(Phaser.Math.distance(c,e,b,d))},clamp:function(d,e,c){return(d c)?c:d)},clampBottom:function(b,c){return b =b){return 1}c=(c-d)/(b-d);return c*c*(3-2*c)},smootherstep:function(c,d,b){if(c<=d){return 0}if(c>=b){return 1}c=(c-d)/(b-d);return c*c*c*(c*(c*6-15)+10)},sign:function(b){return(b<0)?-1:((b>0)?1:0)},degToRad:function(){var b=Math.PI/180;return function(c){return c*b}}(),radToDeg:function(){var b=180/Math.PI;return function(c){return c*b}}()};Phaser.QuadTree=function(g,c,i,f,b,e,d,h){this.physicsManager=g;this.ID=g.quadTreeID;g.quadTreeID++;this.maxObjects=e||10;this.maxLevels=d||4;this.level=h||0;this.bounds={x:Math.round(c),y:Math.round(i),width:f,height:b,subWidth:Math.floor(f/2),subHeight:Math.floor(b/2),right:Math.round(c)+Math.floor(f/2),bottom:Math.round(i)+Math.floor(b/2)};this.objects=[];this.nodes=[]};Phaser.QuadTree.prototype={split:function(){this.level++;this.nodes[0]=new Phaser.QuadTree(this.physicsManager,this.bounds.right,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level);this.nodes[1]=new Phaser.QuadTree(this.physicsManager,this.bounds.x,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level);this.nodes[2]=new Phaser.QuadTree(this.physicsManager,this.bounds.x,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level);this.nodes[3]=new Phaser.QuadTree(this.physicsManager,this.bounds.right,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level)},insert:function(b){var d=0;var c;if(this.nodes[0]!=null){c=this.getIndex(b);if(c!==-1){this.nodes[c].insert(b);return}}this.objects.push(b);if(this.objects.length>this.maxObjects&&this.level this.bounds.bottom)){b=2}}}else{if(c.x>this.bounds.right){if((c.y this.bounds.bottom)){b=3}}}}return b},retrieve:function(b){var c=this.objects;b.body.quadTreeIndex=this.getIndex(b.body);b.body.quadTreeIDs.push(this.ID);if(this.nodes[0]){if(b.body.quadTreeIndex!==-1){c=c.concat(this.nodes[b.body.quadTreeIndex].retrieve(b))}else{c=c.concat(this.nodes[0].retrieve(b));c=c.concat(this.nodes[1].retrieve(b));c=c.concat(this.nodes[2].retrieve(b));c=c.concat(this.nodes[3].retrieve(b))}}return c},clear:function(){this.objects=[];for(var c=0,b=this.nodes.length;c0){this._radius=c*0.5}else{this._radius=0}};Phaser.Circle.prototype={circumference:function(){return 2*(Math.PI*this._radius)},setTo:function(b,d,c){this.x=b;this.y=d;this._diameter=c;this._radius=c*0.5;return this},copyFrom:function(b){return this.setTo(b.x,b.y,b.diameter)},copyTo:function(b){b[x]=this.x;b[y]=this.y;b[diameter]=this._diameter;return b},distance:function(c,b){if(typeof b==="undefined"){b=false}if(b){return Phaser.Math.distanceRound(this.x,this.y,c.x,c.y)}else{return Phaser.Math.distance(this.x,this.y,c.x,c.y)}},clone:function(b){if(typeof b==="undefined"){b=new Phaser.Circle()}return b.setTo(a.x,a.y,a.diameter)},contains:function(b,c){return Phaser.Circle.contains(this,b,c)},circumferencePoint:function(d,c,b){return Phaser.Circle.circumferencePoint(this,d,c,b)},offset:function(c,b){this.x+=c;this.y+=b;return this},offsetPoint:function(b){return this.offset(b.x,b.y)},toString:function(){return"[{Phaser.Circle (x="+this.x+" y="+this.y+" diameter="+this.diameter+" radius="+this.radius+")}]"}};Object.defineProperty(Phaser.Circle.prototype,"diameter",{get:function(){return this._diameter},set:function(b){if(b>0){this._diameter=b;this._radius=b*0.5}}});Object.defineProperty(Phaser.Circle.prototype,"radius",{get:function(){return this._radius},set:function(b){if(b>0){this._radius=b;this._diameter=b*2}}});Object.defineProperty(Phaser.Circle.prototype,"left",{get:function(){return this.x-this._radius},set:function(b){if(b>this.x){this._radius=0;this._diameter=0}else{this.radius=this.x-b}}});Object.defineProperty(Phaser.Circle.prototype,"right",{get:function(){return this.x+this._radius},set:function(b){if(b this.y){this._radius=0;this._diameter=0}else{this.radius=this.y-b}}});Object.defineProperty(Phaser.Circle.prototype,"bottom",{get:function(){return this.y+this._radius},set:function(b){if(b 0){return Math.PI*this._radius*this._radius}else{return 0}}});Object.defineProperty(Phaser.Circle.prototype,"empty",{get:function(){return(this._diameter==0)},set:function(b){this.setTo(0,0,0)}});Phaser.Circle.contains=function(d,b,f){if(b>=d.left&&b<=d.right&&f>=d.top&&f<=d.bottom){var e=(d.x-b)*(d.x-b);var c=(d.y-f)*(d.y-f);return(e+c)<=(d.radius*d.radius)}return false};Phaser.Circle.equals=function(d,c){return(d.x==c.x&&d.y==c.y&&d.diameter==c.diameter)};Phaser.Circle.intersects=function(d,c){return(Phaser.Math.distance(d.x,d.y,c.x,c.y)<=(d.radius+c.radius))};Phaser.Circle.circumferencePoint=function(b,e,d,c){if(typeof d==="undefined"){d=false}if(typeof c==="undefined"){c=new Phaser.Point()}if(d===true){e=Phaser.Math.radToDeg(e)}c.x=b.x+b.radius*Math.cos(e);c.y=b.y+b.radius*Math.sin(e);return c};Phaser.Circle.intersectsRectangle=function(m,d){var g=Math.abs(m.x-d.x-d.halfWidth);var l=d.halfWidth+m.radius;if(g>l){return false}var f=Math.abs(m.y-d.y-d.halfHeight);var j=d.halfHeight+m.radius;if(f>j){return false}if(g<=d.halfWidth||f<=d.halfHeight){return true}var h=g-d.halfWidth;var e=f-d.halfHeight;var k=h*h;var b=e*e;var i=m.radius*m.radius;return k+b<=i};Phaser.Point=function(b,c){b=b||0;c=c||0;this.x=b;this.y=c};Phaser.Point.prototype={copyFrom:function(b){return this.setTo(b.x,b.y)},invert:function(){return this.setTo(this.y,this.x)},setTo:function(b,c){this.x=b;this.y=c;return this},add:function(b,c){this.x+=b;this.y+=c;return this},subtract:function(b,c){this.x-=b;this.y-=c;return this},multiply:function(b,c){this.x*=b;this.y*=c;return this},divide:function(b,c){this.x/=b;this.y/=c;return this},clampX:function(c,b){this.x=Phaser.Math.clamp(this.x,c,b);return this},clampY:function(c,b){this.y=Phaser.Math.clamp(this.y,c,b);return this},clamp:function(c,b){this.x=Phaser.Math.clamp(this.x,c,b);this.y=Phaser.Math.clamp(this.y,c,b);return this},clone:function(b){if(typeof b==="undefined"){b=new Phaser.Point}return b.setTo(this.x,this.y)},copyFrom:function(b){return this.setTo(b.x,b.y)},copyTo:function(b){b[x]=this.x;b[y]=this.y;return b},distance:function(c,b){return Phaser.Point.distance(this,c,b)},equals:function(b){return(b.x==this.x&&b.y==this.y)},rotate:function(b,f,d,c,e){return Phaser.Point.rotate(this,b,f,d,c,e)},toString:function(){return"[{Point (x="+this.x+" y="+this.y+")}]"}};Phaser.Point.add=function(d,c,e){if(typeof e==="undefined"){e=new Phaser.Point()}e.x=d.x+c.x;e.y=d.y+c.y;return e};Phaser.Point.subtract=function(d,c,e){if(typeof e==="undefined"){e=new Phaser.Point()}e.x=d.x-c.x;e.y=d.y-c.y;return e};Phaser.Point.multiply=function(d,c,e){if(typeof e==="undefined"){e=new Phaser.Point()}e.x=d.x*c.x;e.y=d.y*c.y;return e};Phaser.Point.divide=function(d,c,e){if(typeof e==="undefined"){e=new Phaser.Point()}e.x=d.x/c.x;e.y=d.y/c.y;return e};Phaser.Point.equals=function(d,c){return(d.x==c.x&&d.y==c.y)};Phaser.Point.distance=function(d,c,e){if(typeof e==="undefined"){e=false}if(e){return Phaser.Math.distanceRound(d.x,d.y,c.x,c.y)}else{return Phaser.Math.distance(d.x,d.y,c.x,c.y)}},Phaser.Point.rotate=function(c,b,g,e,d,f){d=d||false;f=f||null;if(d){e=Phaser.Math.radToDeg(e)}if(f===null){f=Math.sqrt(((b-c.x)*(b-c.x))+((g-c.y)*(g-c.y)))}return c.setTo(b+f*Math.cos(e),g+f*Math.sin(e))};Phaser.Rectangle=function(c,e,d,b){c=c||0;e=e||0;d=d||0;b=b||0;this.x=c;this.y=e;this.width=d;this.height=b};Phaser.Rectangle.prototype={offset:function(c,b){this.x+=c;this.y+=b;return this},offsetPoint:function(b){return this.offset(b.x,b.y)},setTo:function(c,e,d,b){this.x=c;this.y=e;this.width=d;this.height=b;return this},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y)},copyFrom:function(b){return this.setTo(b.x,b.y,b.width,b.height)},copyTo:function(b){b.x=this.x;b.y=this.y;b.width=this.width;b.height=this.height;return b},inflate:function(c,b){return Phaser.Rectangle.inflate(this,c,b)},size:function(b){return Phaser.Rectangle.size(this,b)},clone:function(b){return Phaser.Rectangle.clone(this,b)},contains:function(b,c){return Phaser.Rectangle.contains(this,b,c)},containsRect:function(c){return Phaser.Rectangle.containsRect(this,c)},equals:function(c){return Phaser.Rectangle.equals(this,c)},intersection:function(c,d){return Phaser.Rectangle.intersection(this,c,output)},intersects:function(c,d){return Phaser.Rectangle.intersects(this,c,d)},intersectsRaw:function(f,d,e,c,b){return Phaser.Rectangle.intersectsRaw(this,f,d,e,c,b)},union:function(c,d){return Phaser.Rectangle.union(this,c,d)},toString:function(){return"[{Rectangle (x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+" empty="+this.empty+")}]"}};Object.defineProperty(Phaser.Rectangle.prototype,"halfWidth",{get:function(){return Math.round(this.width/2)}});Object.defineProperty(Phaser.Rectangle.prototype,"halfHeight",{get:function(){return Math.round(this.height/2)}});Object.defineProperty(Phaser.Rectangle.prototype,"bottom",{get:function(){return this.y+this.height},set:function(b){if(b<=this.y){this.height=0}else{this.height=(this.y-b)}}});Object.defineProperty(Phaser.Rectangle.prototype,"bottomRight",{get:function(){return new Phaser.Point(this.right,this.bottom)},set:function(b){this.right=b.x;this.bottom=b.y}});Object.defineProperty(Phaser.Rectangle.prototype,"left",{get:function(){return this.x},set:function(b){if(b>=this.right){this.width=0}else{this.width=this.right-b}this.x=b}});Object.defineProperty(Phaser.Rectangle.prototype,"right",{get:function(){return this.x+this.width},set:function(b){if(b<=this.x){this.width=0}else{this.width=this.x+b}}});Object.defineProperty(Phaser.Rectangle.prototype,"volume",{get:function(){return this.width*this.height}});Object.defineProperty(Phaser.Rectangle.prototype,"perimeter",{get:function(){return(this.width*2)+(this.height*2)}});Object.defineProperty(Phaser.Rectangle.prototype,"centerX",{get:function(){return this.x+this.halfWidth},set:function(b){this.x=b-this.halfWidth}});Object.defineProperty(Phaser.Rectangle.prototype,"centerY",{get:function(){return this.y+this.halfHeight},set:function(b){this.y=b-this.halfHeight}});Object.defineProperty(Phaser.Rectangle.prototype,"top",{get:function(){return this.y},set:function(b){if(b>=this.bottom){this.height=0;this.y=b}else{this.height=(this.bottom-b)}}});Object.defineProperty(Phaser.Rectangle.prototype,"topLeft",{get:function(){return new Phaser.Point(this.x,this.y)},set:function(b){this.x=b.x;this.y=b.y}});Object.defineProperty(Phaser.Rectangle.prototype,"empty",{get:function(){return(!this.width||!this.height)},set:function(b){this.setTo(0,0,0,0)}});Phaser.Rectangle.inflate=function(c,d,b){c.x-=d;c.width+=2*d;c.y-=b;c.height+=2*b;return c};Phaser.Rectangle.inflatePoint=function(c,b){return Phaser.Phaser.Rectangle.inflate(c,b.x,b.y)};Phaser.Rectangle.size=function(b,c){if(typeof c==="undefined"){c=new Phaser.Point()}return c.setTo(b.width,b.height)};Phaser.Rectangle.clone=function(b,c){if(typeof c==="undefined"){c=new Phaser.Rectangle()}return c.setTo(b.x,b.y,b.width,b.height)};Phaser.Rectangle.contains=function(c,b,d){return(b>=c.x&&b<=c.right&&d>=c.y&&d<=c.bottom)};Phaser.Rectangle.containsPoint=function(c,b){return Phaser.Phaser.Rectangle.contains(c,b.x,b.y)};Phaser.Rectangle.containsRect=function(d,c){if(d.volume>c.volume){return false}return(d.x>=c.x&&d.y>=c.y&&d.right<=c.right&&d.bottom<=c.bottom)};Phaser.Rectangle.equals=function(d,c){return(d.x==c.x&&d.y==c.y&&d.width==c.width&&d.height==c.height)};Phaser.Rectangle.intersection=function(d,c,e){e=e||new Phaser.Rectangle;if(Phaser.Rectangle.intersects(d,c)){e.x=Math.max(d.x,c.x);e.y=Math.max(d.y,c.y);e.width=Math.min(d.right,c.right)-e.x;e.height=Math.min(d.bottom,c.bottom)-e.y}return e};Phaser.Rectangle.intersects=function(d,c,e){e=e||0;return !(d.left>c.right+e||d.right c.bottom+e||d.bottom b.right+c||e b.bottom+c||d 1){if(f&&f==this.decodeURI(d[0])){return this.decodeURI(d[1])}else{c[this.decodeURI(d[0])]=this.decodeURI(d[1])}}}return c},decodeURI:function(b){return decodeURIComponent(b.replace(/\+/g," "))}};Phaser.TweenManager=function(b){this.game=b;this._tweens=[];this.game.onPause.add(this.pauseAll,this);this.game.onResume.add(this.resumeAll,this)};Phaser.TweenManager.prototype={REVISION:"11dev",getAll:function(){return this._tweens},removeAll:function(){this._tweens=[]},add:function(b){this._tweens.push(b)},create:function(b){return new Phaser.Tween(b,this.game)},remove:function(c){var b=this._tweens.indexOf(c);if(b!==-1){this._tweens.splice(b,1)}},update:function(){if(this._tweens.length===0){return false}var b=0,c=this._tweens.length;while(b =0;b--){this._tweens[b].pause()}},resumeAll:function(){for(var b=this._tweens.length-1;b>=0;b--){this._tweens[b].resume()}}};Phaser.Tween=function(c,b){this._object=c;this.game=b;this._manager=this.game.tweens;this._valuesStart={};this._valuesEnd={};this._valuesStartRepeat={};this._duration=1000;this._repeat=0;this._yoyo=false;this._reversed=false;this._delayTime=0;this._startTime=null;this._easingFunction=Phaser.Easing.Linear.None;this._interpolationFunction=Phaser.Math.linearInterpolation;this._chainedTweens=[];this._onStartCallback=null;this._onStartCallbackFired=false;this._onUpdateCallback=null;this._onCompleteCallback=null;this._pausedTime=0;for(var d in c){this._valuesStart[d]=parseFloat(c[d],10)}this.onStart=new Phaser.Signal();this.onComplete=new Phaser.Signal();this.isRunning=false};Phaser.Tween.prototype={to:function(d,g,h,c,b,f,e){g=g||1000;h=h||null;c=c||false;b=b||0;f=f||0;e=e||false;this._repeat=f;this._duration=g;this._valuesEnd=d;if(h!==null){this._easingFunction=h}if(b>0){this._delayTime=b}this._yoyo=e;if(c){return this.start()}else{return this}},start:function(c){if(this.game===null||this._object===null){return}this._manager.add(this);this.onStart.dispatch(this._object);this.isRunning=true;this._onStartCallbackFired=false;this._startTime=this.game.time.now+this._delayTime;for(var b in this._valuesEnd){if(this._valuesEnd[b] instanceof Array){if(this._valuesEnd[b].length===0){continue}this._valuesEnd[b]=[this._object[b]].concat(this._valuesEnd[b])}this._valuesStart[b]=this._object[b];if((this._valuesStart[b] instanceof Array)===false){this._valuesStart[b]*=1}this._valuesStartRepeat[b]=this._valuesStart[b]||0}return this},stop:function(){this._manager.remove(this);this.isRunning=false;return this},delay:function(b){this._delayTime=b;return this},repeat:function(b){this._repeat=b;return this},yoyo:function(b){this._yoyo=b;return this},easing:function(b){this._easingFunction=b;return this},interpolation:function(b){this._interpolationFunction=b;return this},chain:function(){this._chainedTweens=arguments;return this},onStart:function(b){this._onStartCallback=b;return this},onUpdate:function(b){this._onUpdateCallback=b;return this},onComplete:function(b){this._onCompleteCallback=b;return this},pause:function(){this._paused=true},resume:function(){this._paused=false;this._startTime+=this.game.time.pauseDuration},update:function(c){if(this._paused||c 1?1:k;var h=this._easingFunction(k);for(j in this._valuesEnd){var b=this._valuesStart[j]||0;var d=this._valuesEnd[j];if(d instanceof Array){this._object[j]=this._interpolationFunction(d,h)}else{if(typeof(d)==="string"){d=b+parseFloat(d,10)}if(typeof(d)==="number"){this._object[j]=b+(d-b)*h}}}if(this._onUpdateCallback!==null){this._onUpdateCallback.call(this._object,h)}if(k==1){if(this._repeat>0){if(isFinite(this._repeat)){this._repeat--}for(j in this._valuesStartRepeat){if(typeof(this._valuesEnd[j])==="string"){this._valuesStartRepeat[j]=this._valuesStartRepeat[j]+parseFloat(this._valuesEnd[j],10)}if(this._yoyo){var e=this._valuesStartRepeat[j];this._valuesStartRepeat[j]=this._valuesEnd[j];this._valuesEnd[j]=e;this._reversed=!this._reversed}this._valuesStart[j]=this._valuesStartRepeat[j]}this._startTime=c+this._delayTime;this.onComplete.dispatch(this._object);if(this._onCompleteCallback!==null){this._onCompleteCallback.call(this._object)}return true}else{this.onComplete.dispatch(this._object);if(this._onCompleteCallback!==null){this._onCompleteCallback.call(this._object)}for(var f=0,g=this._chainedTweens.length;f this._timeLastSecond+1000){this.fps=Math.round((this.frames*1000)/(this.now-this._timeLastSecond));this.fpsMin=this.game.math.min(this.fpsMin,this.fps);this.fpsMax=this.game.math.max(this.fpsMax,this.fps);this._timeLastSecond=this.now;this.frames=0}this.time=this.now;this.lastTime=b+this.timeToCall;this.physicsElapsed=1*(this.elapsed/1000);if(this.game.paused){this.pausedTime=this.now-this._pauseStarted}},gamePaused:function(){this._pauseStarted=this.now},gameResumed:function(){this.time=Date.now();this.pauseDuration=this.pausedTime;this._justResumed=true},elapsedSince:function(b){return this.now-b},elapsedSecondsSince:function(b){return(this.now-b)*0.001},reset:function(){this._started=this.now}};Phaser.AnimationManager=function(b){this._frameData=null;this.currentFrame=null;this.sprite=b;this.game=b.game;this._anims={};this.updateIfVisible=true};Phaser.AnimationManager.prototype={loadFrameData:function(b){this._frameData=b;this.frame=0},add:function(e,f,d,c,b){f=f||null;d=d||60;c=c||false;b=b||true;if(this._frameData==null){console.warn("No frameData available for Phaser.Animation "+e);return}if(this.sprite.events.onAnimationStart==null){this.sprite.events.onAnimationStart=new Phaser.Signal();this.sprite.events.onAnimationComplete=new Phaser.Signal();this.sprite.events.onAnimationLoop=new Phaser.Signal()}if(f==null){f=this._frameData.getFrameIndexes()}else{if(this.validateFrames(f,b)==false){console.warn("Invalid frames given to Phaser.Animation "+e);return}}if(b==false){f=this._frameData.getFrameIndexesByName(f)}this._anims[e]=new Phaser.Animation(this.game,this.sprite,this._frameData,e,f,d,c);this.currentAnim=this._anims[e];this.currentFrame=this.currentAnim.currentFrame;this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]);return this._anims[e]},validateFrames:function(d,b){for(var c=0;c this._frameData.total){return false}}else{if(this._frameData.checkFrameName(d[c])==false){return false}}}return true},play:function(d,c,b){c=c||null;b=b||null;if(this._anims[d]){if(this.currentAnim==this._anims[d]){if(this.currentAnim.isPlaying==false){return this.currentAnim.play(c,b)}}else{this.currentAnim=this._anims[d];return this.currentAnim.play(c,b)}}},stop:function(b){if(this._anims[b]){this.currentAnim=this._anims[b];this.currentAnim.stop()}},update:function(){if(this.updateIfVisible&&this.sprite.visible==false){return false}if(this.currentAnim&&this.currentAnim.update()==true){this.currentFrame=this.currentAnim.currentFrame;this.sprite.currentFrame=this.currentFrame;return true}return false},destroy:function(){this._anims={};this._frameData=null;this._frameIndex=0;this.currentAnim=null;this.currentFrame=null}};Object.defineProperty(Phaser.AnimationManager.prototype,"frameData",{get:function(){return this._frameData}});Object.defineProperty(Phaser.AnimationManager.prototype,"frameTotal",{get:function(){if(this._frameData){return this._frameData.total}else{return -1}}});Object.defineProperty(Phaser.AnimationManager.prototype,"frame",{get:function(){if(this.currentFrame){return this._frameIndex}},set:function(b){if(this._frameData&&this._frameData.getFrame(b)!==null){this.currentFrame=this._frameData.getFrame(b);this._frameIndex=b;this.sprite.currentFrame=this.currentFrame;this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid])}}});Object.defineProperty(Phaser.AnimationManager.prototype,"frameName",{get:function(){if(this.currentFrame){return this.currentFrame.name}},set:function(b){if(this._frameData&&this._frameData.getFrameByName(b)){this.currentFrame=this._frameData.getFrameByName(b);this._frameIndex=this.currentFrame.index;this.sprite.currentFrame=this.currentFrame;this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid])}else{console.warn("Cannot set frameName: "+b)}}});Phaser.Animation=function(c,g,f,e,h,d,b){this.game=c;this._parent=g;this._frames=h;this._frameData=f;this.name=e;this.delay=1000/d;this.looped=b;this.isFinished=false;this.isPlaying=false;this._frameIndex=0;this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex])};Phaser.Animation.prototype={play:function(c,b){c=c||null;b=b||null;if(c!==null){this.delay=1000/c}if(b!==null){this.looped=b}this.isPlaying=true;this.isFinished=false;this._timeLastFrame=this.game.time.now;this._timeNextFrame=this.game.time.now+this.delay;this._frameIndex=0;this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]);this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]);this._parent.events.onAnimationStart.dispatch(this._parent,this);return this},restart:function(){this.isPlaying=true;this.isFinished=false;this._timeLastFrame=this.game.time.now;this._timeNextFrame=this.game.time.now+this.delay;this._frameIndex=0;this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex])},stop:function(){this.isPlaying=false;this.isFinished=true},update:function(){if(this.isPlaying==true&&this.game.time.now>=this._timeNextFrame){this._frameIndex++;if(this._frameIndex==this._frames.length){if(this.looped){this._frameIndex=0;this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]);this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]);this._parent.events.onAnimationLoop.dispatch(this._parent,this)}else{this.onComplete()}}else{this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]);this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid])}this._timeLastFrame=this.game.time.now;this._timeNextFrame=this.game.time.now+this.delay;return true}return false},destroy:function(){this.game=null;this._parent=null;this._frames=null;this._frameData=null;this.currentFrame=null;this.isPlaying=false},onComplete:function(){this.isPlaying=false;this.isFinished=true;this._parent.events.onAnimationComplete.dispatch(this._parent,this)}};Object.defineProperty(Phaser.Animation.prototype,"frameTotal",{get:function(){return this._frames.length}});Object.defineProperty(Phaser.Animation.prototype,"frame",{get:function(){if(this.currentFrame!==null){return this.currentFrame.index}else{return this._frameIndex}},set:function(b){this.currentFrame=this._frameData.getFrame(b);if(this.currentFrame!==null){this._frameIndex=b;this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid])}}});Phaser.Animation.Frame=function(c,g,f,b,d,e){this.x=c;this.y=g;this.width=f;this.height=b;this.centerX=Math.floor(f/2);this.centerY=Math.floor(b/2);this.index=0;this.name=d;this.uuid=e;this.distance=Phaser.Math.distance(0,0,f,b);this.rotated=false;this.rotationDirection="cw";this.trimmed=false;this.sourceSizeW=f;this.sourceSizeH=b;this.spriteSourceSizeX=0;this.spriteSourceSizeY=0;this.spriteSourceSizeW=0;this.spriteSourceSizeH=0};Phaser.Animation.Frame.prototype={setTrim:function(f,e,h,c,b,d,g){this.trimmed=f;if(f){this.width=e;this.height=h;this.sourceSizeW=e;this.sourceSizeH=h;this.centerX=Math.floor(e/2);this.centerY=Math.floor(h/2);this.spriteSourceSizeX=c;this.spriteSourceSizeY=b;this.spriteSourceSizeW=d;this.spriteSourceSizeH=g}}};Phaser.Animation.FrameData=function(){this._frames=[];this._frameNames=[]};Phaser.Animation.FrameData.prototype={addFrame:function(b){b.index=this._frames.length;this._frames.push(b);if(b.name!==""){this._frameNames[b.name]=b.index}return b},getFrame:function(b){if(this._frames[b]){return this._frames[b]}return null},getFrameByName:function(b){if(this._frameNames[b]!==""){return this._frames[this._frameNames[b]]}return null},checkFrameName:function(b){if(this._frameNames[b]==null){return false}return true},getFrameRange:function(e,b,c){if(typeof c==="undefined"){c=[]}for(var d=e;d<=b;d++){c.push(this._frames[d])}return c},getFrameIndexes:function(b){if(typeof b==="undefined"){b=[]}for(var c=0;c tag");return}var d=new Phaser.Animation.FrameData();var j=g.getElementsByTagName("SubTexture");var f;for(var e=0;e 0){this._progressChunk=100/this._keys.length;this.loadFile()}else{this.progress=100;this.hasLoaded=true;this.onLoadComplete.dispatch()}},loadFile:function(){var b=this._fileList[this._keys.shift()];var c=this;switch(b.type){case"image":case"spritesheet":case"textureatlas":case"bitmapfont":case"tilemap":b.data=new Image();b.data.name=b.key;b.data.onload=function(){return c.fileComplete(b.key)};b.data.onerror=function(){return c.fileError(b.key)};b.data.crossOrigin=this.crossOrigin;b.data.src=this.baseURL+b.url;break;case"audio":b.url=this.getAudioURL(b.url);if(b.url!==null){if(this.game.sound.usingWebAudio){this._xhr.open("GET",this.baseURL+b.url,true);this._xhr.responseType="arraybuffer";this._xhr.onload=function(){return c.fileComplete(b.key)};this._xhr.onerror=function(){return c.fileError(b.key)};this._xhr.send()}else{if(this.game.sound.usingAudioTag){if(this.game.sound.touchLocked){b.data=new Audio();b.data.name=b.key;b.data.preload="auto";b.data.src=this.baseURL+b.url;this.fileComplete(b.key)}else{b.data=new Audio();b.data.name=b.key;b.data.onerror=function(){return c.fileError(b.key)};b.data.preload="auto";b.data.src=this.baseURL+b.url;b.data.addEventListener("canplaythrough",Phaser.GAMES[this.game.id].load.fileComplete(b.key),false);b.data.load()}}}}else{this.fileError(b.key)}break;case"text":this._xhr.open("GET",this.baseURL+b.url,true);this._xhr.responseType="text";this._xhr.onload=function(){return c.fileComplete(b.key)};this._xhr.onerror=function(){return c.fileError(b.key)};this._xhr.send();break}},getAudioURL:function(c){var d;for(var b=0;b 100){this.progress=100}this.onFileComplete.dispatch(this.progress,b,c,this.queueSize-this._keys.length,this.queueSize);if(this._keys.length>0){this.loadFile()}else{this.hasLoaded=true;this.isLoading=false;this.removeAll();this.onLoadComplete.dispatch()}}};Phaser.Loader.Parser={bitmapFont:function(q,h,l){if(!h.getElementsByTagName("font")){console.warn("Phaser.Loader.Parser.bitmapFont: Invalid XML given, missing tag");return}var m=PIXI.TextureCache[l];var e={};var c=h.getElementsByTagName("info")[0];var j=h.getElementsByTagName("common")[0];e.font=c.attributes.getNamedItem("face").nodeValue;e.size=parseInt(c.attributes.getNamedItem("size").nodeValue,10);e.lineHeight=parseInt(j.attributes.getNamedItem("lineHeight").nodeValue,10);e.chars={};var k=h.getElementsByTagName("char");for(var d=0;d =this.duration){if(this.usingWebAudio){if(this.loop){this.onLoop.dispatch(this);if(this.currentMarker==""){this.currentTime=0;this.startTime=this.game.time.now}else{this.play(this.currentMarker,0,this.volume,true,true)}}else{this.stop()}}else{if(this.loop){this.onLoop.dispatch(this);this.play(this.currentMarker,0,this.volume,true,true)}else{this.stop()}}}}},play:function(d,b,f,c,e){d=d||"";b=b||0;f=f||1;c=c||false;e=e||false;if(this.isPlaying==true&&e==false&&this.override==false){return}if(this.isPlaying&&this.override){if(this.usingWebAudio){if(typeof this._sound.stop==="undefined"){this._sound.noteOff(0)}else{this._sound.stop(0)}}else{if(this.usingAudioTag){this._sound.pause();this._sound.currentTime=0}}}this.currentMarker=d;if(d!==""&&this.markers[d]){this.position=this.markers[d].start;this.volume=this.markers[d].volume;this.loop=this.markers[d].loop;this.duration=this.markers[d].duration*1000;this._tempMarker=d;this._tempPosition=this.position;this._tempVolume=this.volume;this._tempLoop=this.loop}else{this.position=b;this.volume=f;this.loop=c;this.duration=0;this._tempMarker=d;this._tempPosition=b;this._tempVolume=f;this._tempLoop=c}if(this.usingWebAudio){if(this.game.cache.isSoundDecoded(this.key)){if(this._buffer==null){this._buffer=this.game.cache.getSoundData(this.key)}this._sound=this.context.createBufferSource();this._sound.buffer=this._buffer;this._sound.connect(this.gainNode);this.totalDuration=this._sound.buffer.duration;if(this.duration==0){this.duration=this.totalDuration*1000}if(this.loop&&d==""){this._sound.loop=true}if(typeof this._sound.start==="undefined"){this._sound.noteGrainOn(0,this.position,this.duration/1000)}else{this._sound.start(0,this.position,this.duration/1000)}this.isPlaying=true;this.startTime=this.game.time.now;this.currentTime=0;this.stopTime=this.startTime+this.duration;this.onPlay.dispatch(this)}else{this.pendingPlayback=true;if(this.game.cache.getSound(this.key)&&this.game.cache.getSound(this.key).isDecoding==false){this.game.sound.decode(this.key,this)}}}else{if(this.game.cache.getSound(this.key)&&this.game.cache.getSound(this.key).locked){this.game.cache.reloadSound(this.key);this.pendingPlayback=true}else{if(this._sound&&this._sound.readyState==4){this._sound.play();this.totalDuration=this._sound.duration;if(this.duration==0){this.duration=this.totalDuration*1000}this._sound.currentTime=this.position;this._sound.muted=this._muted;if(this._muted){this._sound.volume=0}else{this._sound.volume=this._volume}this.isPlaying=true;this.startTime=this.game.time.now;this.currentTime=0;this.stopTime=this.startTime+this.duration;this.onPlay.dispatch(this)}else{this.pendingPlayback=true}}}},restart:function(d,b,e,c){d=d||"";b=b||0;e=e||1;c=c||false;this.play(d,b,e,c,true)},pause:function(){if(this.isPlaying&&this._sound){this.stop();this.isPlaying=false;this.paused=true;this.onPause.dispatch(this)}},resume:function(){if(this.paused&&this._sound){if(this.usingWebAudio){if(typeof this._sound.start==="undefined"){this._sound.noteGrainOn(0,this.position,this.duration)}else{this._sound.start(0,this.position,this.duration)}}else{this._sound.play()}this.isPlaying=true;this.paused=false;this.onResume.dispatch(this)}},stop:function(){if(this.isPlaying&&this._sound){if(this.usingWebAudio){if(typeof this._sound.stop==="undefined"){this._sound.noteOff(0)}else{this._sound.stop(0)}}else{if(this.usingAudioTag){this._sound.pause();this._sound.currentTime=0}}}this.isPlaying=false;var b=this.currentMarker;this.currentMarker="";this.onStop.dispatch(this,b)}};Object.defineProperty(Phaser.Sound.prototype,"isDecoding",{get:function(){return this.game.cache.getSound(this.key).isDecoding}});Object.defineProperty(Phaser.Sound.prototype,"isDecoded",{get:function(){return this.game.cache.isSoundDecoded(this.key)}});Object.defineProperty(Phaser.Sound.prototype,"mute",{get:function(){return this._muted},set:function(b){b=b||null;if(b){this._muted=true;if(this.usingWebAudio){this._muteVolume=this.gainNode.gain.value;this.gainNode.gain.value=0}else{if(this.usingAudioTag&&this._sound){this._muteVolume=this._sound.volume;this._sound.volume=0}}}else{this._muted=false;if(this.usingWebAudio){this.gainNode.gain.value=this._muteVolume}else{if(this.usingAudioTag&&this._sound){this._sound.volume=this._muteVolume}}}this.onMute.dispatch(this)}});Object.defineProperty(Phaser.Sound.prototype,"volume",{get:function(){return this._volume},set:function(b){if(this.usingWebAudio){this._volume=b;this.gainNode.gain.value=b}else{if(this.usingAudioTag&&this._sound){if(b>=0&&b<=1){this._volume=b;this._sound.volume=b}}}}});Phaser.SoundManager=function(b){this.game=b;this.onSoundDecode=new Phaser.Signal;this._muted=false;this._unlockSource=null;this._volume=1;this._muted=false;this._sounds=[];this.context=null;this.usingWebAudio=true;this.usingAudioTag=false;this.noAudio=false;this.touchLocked=false;this.channels=32};Phaser.SoundManager.prototype={boot:function(){if(this.game.device.iOS&&this.game.device.webAudio==false){this.channels=1}if(this.game.device.iOS||(window.PhaserGlobal&&window.PhaserGlobal.fakeiOSTouchLock)){this.game.input.touch.callbackContext=this;this.game.input.touch.touchStartCallback=this.unlock;this.game.input.mouse.callbackContext=this;this.game.input.mouse.mouseDownCallback=this.unlock;this.touchLocked=true}else{this.touchLocked=false}if(window.PhaserGlobal){if(window.PhaserGlobal.disableAudio==true){this.usingWebAudio=false;this.noAudio=true;return}if(window.PhaserGlobal.disableWebAudio==true){this.usingWebAudio=false;this.usingAudioTag=true;this.noAudio=false;return}}if(!!window.AudioContext){this.context=new window.AudioContext()}else{if(!!window.webkitAudioContext){this.context=new window.webkitAudioContext()}else{if(!!window.Audio){this.usingWebAudio=false;this.usingAudioTag=true}else{this.usingWebAudio=false;this.noAudio=true}}}if(this.context!==null){if(typeof this.context.createGain==="undefined"){this.masterGain=this.context.createGainNode()}else{this.masterGain=this.context.createGain()}this.masterGain.gain.value=1;this.masterGain.connect(this.context.destination)}},unlock:function(){if(this.touchLocked==false){return}if(this.game.device.webAudio==false||(window.PhaserGlobal&&window.PhaserGlobal.disableWebAudio==true)){this.touchLocked=false;this._unlockSource=null;this.game.input.touch.callbackContext=null;this.game.input.touch.touchStartCallback=null;this.game.input.mouse.callbackContext=null;this.game.input.mouse.mouseDownCallback=null}else{var b=this.context.createBuffer(1,1,22050);this._unlockSource=this.context.createBufferSource();this._unlockSource.buffer=b;this._unlockSource.connect(this.context.destination);this._unlockSource.noteOn(0)}},stopAll:function(){for(var b=0;b 255){return Phaser.Color.getColor(255,255,255)}if(d>c){return Phaser.Color.getColor(255,255,255)}var f=d+Math.round(Math.random()*(c-d));var e=d+Math.round(Math.random()*(c-d));var b=d+Math.round(Math.random()*(c-d));return Phaser.Color.getColor32(g,f,e,b)},getRGB:function(b){return{alpha:b>>>24,red:b>>16&255,green:b>>8&255,blue:b&255}},getWebRGB:function(c){var f=(c>>>24)/255;var e=c>>16&255;var d=c>>8&255;var b=c&255;return"rgba("+e.toString()+","+d.toString()+","+b.toString()+","+f.toString()+")"},getAlpha:function(b){return b>>>24},getAlphaFloat:function(b){return(b>>>24)/255},getRed:function(b){return b>>16&255},getGreen:function(b){return b>>8&255},getBlue:function(b){return b&255}};Phaser.Physics={};Phaser.Physics.Arcade=function(b){this.game=b;this.gravity=new Phaser.Point;this.bounds=new Phaser.Rectangle(0,0,b.world.width,b.world.height);this.maxObjects=10;this.maxLevels=4;this.OVERLAP_BIAS=4;this.TILE_OVERLAP=false;this.quadTree=new Phaser.QuadTree(this,this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,this.maxObjects,this.maxLevels);this.quadTreeID=0;this._bounds1=new Phaser.Rectangle;this._bounds2=new Phaser.Rectangle;this._overlap=0;this._maxOverlap=0;this._velocity1=0;this._velocity2=0;this._newVelocity1=0;this._newVelocity2=0;this._average=0;this._mapData=[];this._result=false;this._total=0};Phaser.Physics.Arcade.prototype={updateMotion:function(b){this._velocityDelta=(this.computeVelocity(0,false,b.angularVelocity,b.angularAcceleration,b.angularDrag,b.maxAngular)-b.angularVelocity)/2;b.angularVelocity+=this._velocityDelta;b.rotation+=b.angularVelocity*this.game.time.physicsElapsed;this._velocityDelta=(this.computeVelocity(1,b,b.velocity.x,b.acceleration.x,b.drag.x)-b.velocity.x)/2;b.velocity.x+=this._velocityDelta;this._delta=b.velocity.x*this.game.time.physicsElapsed;b.x+=this._delta;this._velocityDelta=(this.computeVelocity(2,b,b.velocity.y,b.acceleration.y,b.drag.y)-b.velocity.y)/2;b.velocity.y+=this._velocityDelta;this._delta=b.velocity.y*this.game.time.physicsElapsed;b.y+=this._delta},computeVelocity:function(e,c,g,f,d,b){b=b||10000;if(e==1&&c.allowGravity){g+=this.gravity.x+c.gravity.x}else{if(e==2&&c.allowGravity){g+=this.gravity.y+c.gravity.y}}if(f!==0){g+=f*this.game.time.physicsElapsed}else{if(d!==0){this._drag=d*this.game.time.physicsElapsed;if(g-this._drag>0){g=g-this._drag}else{if(g+this._drag<0){g+=this._drag}else{g=0}}}}if(g!=0){if(g>b){g=b}else{if(g<-b){g=-b}}}return g},preUpdate:function(){this.quadTree.clear();this.quadTreeID=0;this.quadTree=new Phaser.QuadTree(this,this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,this.maxObjects,this.maxLevels)},postUpdate:function(){this.quadTree.clear()},collide:function(f,e,d,c,b){d=d||null;c=c||null;b=b||d;this._result=false;this._total=0;if(f&&e&&f.exists&&e.exists){if(f.type==Phaser.SPRITE&&e.type==Phaser.SPRITE){this.collideSpriteVsSprite(f,e,d,c,b)}else{if(f.type==Phaser.SPRITE&&e.type==Phaser.GROUP){this.collideSpriteVsGroup(f,e,d,c,b)}else{if(f.type==Phaser.GROUP&&e.type==Phaser.SPRITE){this.collideSpriteVsGroup(e,f,d,c,b)}else{if(f.type==Phaser.GROUP&&e.type==Phaser.GROUP){this.collideGroupVsGroup(f,e,d,c,b)}else{if(f.type==Phaser.SPRITE&&e.type==Phaser.TILEMAP){this.collideSpriteVsTilemap(f,e,d,c,b)}else{if(f.type==Phaser.TILEMAP&&e.type==Phaser.SPRITE){this.collideSpriteVsTilemap(e,f,d,c,b)}else{if(f.type==Phaser.GROUP&&e.type==Phaser.TILEMAP){this.collideGroupVsTilemap(f,e,d,c,b)}else{if(f.type==Phaser.TILEMAP&&e.type==Phaser.GROUP){this.collideGroupVsTilemap(e,f,d,c,b)}else{if(f.type==Phaser.EMITTER&&e.type==Phaser.TILEMAP){this.collideGroupVsTilemap(f,e,d,c,b)}else{if(f.type==Phaser.TILEMAP&&e.type==Phaser.EMITTER){this.collideGroupVsTilemap(e,f,d,c,b)}}}}}}}}}}}return(this._total>0)},collideSpriteVsSprite:function(f,e,d,c,b){this.separate(f.body,e.body);if(this._result){if(c){if(c.call(b,f,e)){this._total++;if(d){d.call(b,f,e)}}}else{this._total++;if(d){d.call(b,f,e)}}}},collideGroupVsTilemap:function(g,f,e,d,b){if(g._container.first._iNext){var c=g._container.first._iNext;do{if(c.exists){this.collideSpriteVsTilemap(c,f,e,d,b)}c=c._iNext}while(c!=g._container.last._iNext)}},collideSpriteVsTilemap:function(d,g,f,e,b){this._mapData=g.collisionLayer.getTileOverlaps(d);var c=this._mapData.length;while(c--){if(e){if(e.call(b,d,this._mapData[c].tile)){this._total++;if(f){f.call(b,d,this._mapData[c].tile)}}}else{this._total++;if(f){f.call(b,d,this._mapData[c].tile)}}}},collideSpriteVsGroup:function(e,h,g,f,c){this._potentials=this.quadTree.retrieve(e);for(var d=0,b=this._potentials.length;d0)?c.deltaX():0),c.lastY,c.width+((c.deltaX()>0)?c.deltaX():-c.deltaX()),c.height);this._bounds2.setTo(b.x-((b.deltaX()>0)?b.deltaX():0),b.lastY,b.width+((b.deltaX()>0)?b.deltaX():-b.deltaX()),b.height);if((this._bounds1.right>this._bounds2.x)&&(this._bounds1.x this._bounds2.y)&&(this._bounds1.y b.deltaX()){this._overlap=c.x+c.width-b.x;if((this._overlap>this._maxOverlap)||c.allowCollision.right==false||b.allowCollision.left==false){this._overlap=0}else{c.touching.right=true;b.touching.left=true}}else{if(c.deltaX() this._maxOverlap)||c.allowCollision.left==false||b.allowCollision.right==false){this._overlap=0}else{c.touching.left=true;b.touching.right=true}}}}}if(this._overlap!=0){c.overlapX=this._overlap;b.overlapX=this._overlap;if(c.customSeparateX||b.customSeparateX){return true}this._velocity1=c.velocity.x;this._velocity2=b.velocity.x;if(!c.immovable&&!b.immovable){this._overlap*=0.5;c.x=c.x-this._overlap;b.x+=this._overlap;this._newVelocity1=Math.sqrt((this._velocity2*this._velocity2*b.mass)/c.mass)*((this._velocity2>0)?1:-1);this._newVelocity2=Math.sqrt((this._velocity1*this._velocity1*c.mass)/b.mass)*((this._velocity1>0)?1:-1);this._average=(this._newVelocity1+this._newVelocity2)*0.5;this._newVelocity1-=this._average;this._newVelocity2-=this._average;c.velocity.x=this._average+this._newVelocity1*c.bounce.x;b.velocity.x=this._average+this._newVelocity2*b.bounce.x}else{if(!c.immovable){c.x=c.x-this._overlap;c.velocity.x=this._velocity2-this._velocity1*c.bounce.x}else{if(!b.immovable){b.x+=this._overlap;b.velocity.x=this._velocity1-this._velocity2*b.bounce.x}}}return true}else{return false}},separateY:function(c,b){if(c.immovable&&b.immovable){return false}this._overlap=0;if(c.deltaY()!=b.deltaY()){this._bounds1.setTo(c.x,c.y-((c.deltaY()>0)?c.deltaY():0),c.width,c.height+c.deltaAbsY());this._bounds2.setTo(b.x,b.y-((b.deltaY()>0)?b.deltaY():0),b.width,b.height+b.deltaAbsY());if((this._bounds1.right>this._bounds2.x)&&(this._bounds1.x this._bounds2.y)&&(this._bounds1.y b.deltaY()){this._overlap=c.y+c.height-b.y;if((this._overlap>this._maxOverlap)||c.allowCollision.down==false||b.allowCollision.up==false){this._overlap=0}else{c.touching.down=true;b.touching.up=true}}else{if(c.deltaY() this._maxOverlap)||c.allowCollision.up==false||b.allowCollision.down==false){this._overlap=0}else{c.touching.up=true;b.touching.down=true}}}}}if(this._overlap!=0){c.overlapY=this._overlap;b.overlapY=this._overlap;if(c.customSeparateY||b.customSeparateY){return true}this._velocity1=c.velocity.y;this._velocity2=b.velocity.y;if(!c.immovable&&!b.immovable){this._overlap*=0.5;c.y=c.y-this._overlap;b.y+=this._overlap;this._newVelocity1=Math.sqrt((this._velocity2*this._velocity2*b.mass)/c.mass)*((this._velocity2>0)?1:-1);this._newVelocity2=Math.sqrt((this._velocity1*this._velocity1*c.mass)/b.mass)*((this._velocity1>0)?1:-1);this._average=(this._newVelocity1+this._newVelocity2)*0.5;this._newVelocity1-=this._average;this._newVelocity2-=this._average;c.velocity.y=this._average+this._newVelocity1*c.bounce.y;b.velocity.y=this._average+this._newVelocity2*b.bounce.y}else{if(!c.immovable){c.y=c.y-this._overlap;c.velocity.y=this._velocity2-this._velocity1*c.bounce.y;if(b.active&&b.moves&&(c.deltaY()>b.deltaY())){c.x+=b.x-b.lastX}}else{if(!b.immovable){b.y+=this._overlap;b.velocity.y=this._velocity1-this._velocity2*b.bounce.y;if(c.sprite.active&&c.moves&&(c.deltaY() h)&&(this._bounds1.x g)&&(this._bounds1.y h)&&(this._bounds1.x g)&&(this._bounds1.y 0){this._overlap=d.bottom-g;if(d.allowCollision.down&&b&&this._overlap 0){var h=this.distanceBetween(g,e);f=h/(c/1000)}g.body.velocity.x=Math.cos(b)*f;g.body.velocity.y=Math.sin(b)*f},accelerateTowardsObject:function(f,d,e,b,g){b=b||1000;g=g||1000;var c=this.angleBetween(f,d);f.body.velocity.x=0;f.body.velocity.y=0;f.body.acceleration.x=Math.cos(c)*e;f.body.acceleration.y=Math.sin(c)*e;f.body.maxVelocity.x=b;f.body.maxVelocity.y=g},moveTowardsMouse:function(f,e,c){e=e||60;c=c||0;var b=this.angleBetweenMouse(f);if(c>0){var g=this.distanceToMouse(f);e=g/(c/1000)}f.body.velocity.x=Math.cos(b)*e;f.body.velocity.y=Math.sin(b)*e},accelerateTowardsMouse:function(e,d,b,f){b=b||1000;f=f||1000;var c=this.angleBetweenMouse(e);e.body.velocity.x=0;e.body.velocity.y=0;e.body.acceleration.x=Math.cos(c)*d;e.body.acceleration.y=Math.sin(c)*d;e.body.maxVelocity.x=b;e.body.maxVelocity.y=f},moveTowardsPoint:function(f,g,e,c){e=e||60;c=c||0;var b=this.angleBetweenPoint(f,g);if(c>0){var h=this.distanceToPoint(f,g);e=h/(c/1000)}f.body.velocity.x=Math.cos(b)*e;f.body.velocity.y=Math.sin(b)*e},accelerateTowardsPoint:function(e,f,d,b,g){b=b||1000;g=g||1000;var c=this.angleBetweenPoint(e,f);e.body.velocity.x=0;e.body.velocity.y=0;e.body.acceleration.x=Math.cos(c)*d;e.body.acceleration.y=Math.sin(c)*d;e.body.maxVelocity.x=b;e.body.maxVelocity.y=g},distanceBetween:function(e,c){var f=e.center.x-c.center.x;var d=e.center.y-c.center.y;return Math.sqrt(f*f+d*d)},distanceToPoint:function(c,e){var d=c.center.x-e.x;var b=c.center.y-e.y;return Math.sqrt(d*d+b*b)},distanceToMouse:function(c){var d=c.center.x-this.game.input.x;var b=c.center.y-this.game.input.y;return Math.sqrt(d*d+b*b)},angleBetweenPoint:function(c,f,e){e=e||false;var d=f.x-c.center.x;var b=f.y-c.center.y;if(e){return this.game.math.radToDeg(Math.atan2(b,d))}else{return Math.atan2(b,d)}},angleBetween:function(e,c,g){g=g||false;var f=c.center.x-e.center.x;var d=c.center.y-e.center.y;if(g){return this.game.math.radToDeg(Math.atan2(d,f))}else{return Math.atan2(d,f)}},velocityFromFacing:function(b,c){},angleBetweenMouse:function(c,e){e=e||false;var d=this.game.input.x-c.bounds.x;var b=this.game.input.y-c.bounds.y;if(e){return this.game.math.radToDeg(Math.atan2(b,d))}else{return Math.atan2(b,d)}}};Phaser.Physics.Arcade.Body=function(b){this.sprite=b;this.game=b.game;this.offset=new Phaser.Point;this.x=b.x;this.y=b.y;this.sourceWidth=b.currentFrame.sourceSizeW;this.sourceHeight=b.currentFrame.sourceSizeH;this.width=b.currentFrame.sourceSizeW;this.height=b.currentFrame.sourceSizeH;this.halfWidth=Math.floor(b.currentFrame.sourceSizeW/2);this.halfHeight=Math.floor(b.currentFrame.sourceSizeH/2);this._sx=b.scale.x;this._sy=b.scale.y;this.velocity=new Phaser.Point;this.acceleration=new Phaser.Point;this.drag=new Phaser.Point;this.gravity=new Phaser.Point;this.bounce=new Phaser.Point;this.maxVelocity=new Phaser.Point(10000,10000);this.angularVelocity=0;this.angularAcceleration=0;this.angularDrag=0;this.maxAngular=1000;this.mass=1;this.quadTreeIDs=[];this.quadTreeIndex=-1;this.allowCollision={none:false,any:true,up:true,down:true,left:true,right:true};this.touching={none:true,up:false,down:false,left:false,right:false};this.wasTouching={none:true,up:false,down:false,left:false,right:false};this.immovable=false;this.moves=true;this.rotation=0;this.allowRotation=true;this.allowGravity=true;this.customSeparateX=false;this.customSeparateY=false;this.overlapX=0;this.overlapY=0;this.collideWorldBounds=false;this.lastX=b.x;this.lastY=b.y};Phaser.Physics.Arcade.Body.prototype={updateBounds:function(e,d,c,b){if(c!=this._sx||b!=this._sy){this.width=this.sourceWidth*c;this.height=this.sourceHeight*b;this.halfWidth=Math.floor(this.width/2);this.halfHeight=Math.floor(this.height/2);this._sx=c;this._sy=b}},update:function(){this.wasTouching.none=this.touching.none;this.wasTouching.up=this.touching.up;this.wasTouching.down=this.touching.down;this.wasTouching.left=this.touching.left;this.wasTouching.right=this.touching.right;this.touching.none=true;this.touching.up=false;this.touching.down=false;this.touching.left=false;this.touching.right=false;this.lastX=this.x;this.lastY=this.y;this.rotation=this.sprite.angle;this.x=(this.sprite.x-(this.sprite.anchor.x*this.width))+this.offset.x;this.y=(this.sprite.y-(this.sprite.anchor.y*this.height))+this.offset.y;if(this.moves){this.game.physics.updateMotion(this)}if(this.collideWorldBounds){this.checkWorldBounds()}if(this.allowCollision.none==false&&this.sprite.visible&&this.sprite.alive){this.quadTreeIDs=[];this.quadTreeIndex=-1;this.game.physics.quadTree.insert(this)}this.sprite.x=this.x-this.offset.x+(this.sprite.anchor.x*this.width);this.sprite.y=this.y-this.offset.y+(this.sprite.anchor.y*this.height);if(this.allowRotation){this.sprite.angle=this.rotation}},postUpdate:function(){this.sprite.x=this.x-this.offset.x+(this.sprite.anchor.x*this.width);this.sprite.y=this.y-this.offset.y+(this.sprite.anchor.y*this.height);if(this.allowRotation){this.sprite.angle=this.rotation}},checkWorldBounds:function(){if(this.x this.game.world.bounds.right){this.x=this.game.world.bounds.right-this.width;this.velocity.x*=-this.bounce.x}}if(this.y this.game.world.bounds.bottom){this.y=this.game.world.bounds.bottom-this.height;this.velocity.y*=-this.bounce.y}}},setSize:function(d,c,b,e){b=b||this.offset.x;e=e||this.offset.y;this.sourceWidth=d;this.sourceHeight=c;this.width=this.sourceWidth*this._sx;this.height=this.sourceHeight*this._sy;this.halfWidth=Math.floor(this.width/2);this.halfHeight=Math.floor(this.height/2);this.offset.setTo(b,e)},reset:function(){this.velocity.setTo(0,0);this.acceleration.setTo(0,0);this.angularVelocity=0;this.angularAcceleration=0;this.x=(this.sprite.x-(this.sprite.anchor.x*this.width))+this.offset.x;this.y=(this.sprite.y-(this.sprite.anchor.y*this.height))+this.offset.y;this.lastX=this.x;this.lastY=this.y},deltaAbsX:function(){return(this.deltaX()>0?this.deltaX():-this.deltaX())},deltaAbsY:function(){return(this.deltaY()>0?this.deltaY():-this.deltaY())},deltaX:function(){return this.x-this.lastX},deltaY:function(){return this.y-this.lastY}};Object.defineProperty(Phaser.Physics.Arcade.Body.prototype,"bottom",{get:function(){return this.y+this.height},set:function(b){if(b<=this.y){this.height=0}else{this.height=(this.y-b)}}});Object.defineProperty(Phaser.Physics.Arcade.Body.prototype,"right",{get:function(){return this.x+this.width},set:function(b){if(b<=this.x){this.width=0}else{this.width=this.x+b}}});Phaser.Particles=function(b){this.emitters={};this.ID=0};Phaser.Particles.prototype={emitters:null,add:function(b){this.emitters[b.name]=b;return b},remove:function(b){delete this.emitters[b.name]},update:function(){for(var b in this.emitters){if(this.emitters[b].exists){this.emitters[b].update()}}}};Phaser.Particles.Arcade={};Phaser.Particles.Arcade.Emitter=function(c,b,e,d){d=d||50;Phaser.Group.call(this,c);this.name="emitter"+this.game.particles.ID++;this.type=Phaser.EMITTER;this.x=0;this.y=0;this.width=1;this.height=1;this.minParticleSpeed=new Phaser.Point(-100,-100);this.maxParticleSpeed=new Phaser.Point(100,100);this.minParticleScale=1;this.maxParticleScale=1;this.minRotation=-360;this.maxRotation=360;this.gravity=2;this.particleClass=null;this.particleDrag=new Phaser.Point();this.frequency=100;this.maxParticles=d;this.lifespan=2000;this.bounce=0;this._quantity=0;this._timer=0;this._counter=0;this._explode=true;this.on=false;this.exists=true;this.emitX=b;this.emitY=e};Phaser.Particles.Arcade.Emitter.prototype=Object.create(Phaser.Group.prototype);Phaser.Particles.Arcade.Emitter.prototype.constructor=Phaser.Particles.Arcade.Emitter;Phaser.Particles.Arcade.Emitter.prototype.update=function(){if(this.on){if(this._explode){this._counter=0;do{this.emitParticle();this._counter++}while(this._counter =this._timer){this.emitParticle();this._counter++;if(this._quantity>0){if(this._counter>=this._quantity){this.on=false}}this._timer=this.game.time.now+this.frequency}}}};Phaser.Particles.Arcade.Emitter.prototype.makeParticles=function(d,h,f,e){if(typeof h=="undefined"){h=0}f=f||this.maxParticles;e=e||0;var j;var b=0;var c=d;var g=0;while(b 0){j.body.allowCollision.any=true;j.body.allowCollision.none=false}else{j.body.allowCollision.none=true}j.exists=false;j.visible=false;j.anchor.setTo(0.5,0.5);this.add(j);b++}return this};Phaser.Particles.Arcade.Emitter.prototype.kill=function(){this.on=false;this.alive=false;this.exists=false};Phaser.Particles.Arcade.Emitter.prototype.revive=function(){this.alive=true;this.exists=true};Phaser.Particles.Arcade.Emitter.prototype.start=function(b,e,d,c){if(typeof b!=="boolean"){b=true}e=e||0;d=d||250;c=c||0;this.revive();this.visible=true;this.on=true;this._explode=b;this.lifespan=e;this.frequency=d;this._quantity+=c;this._counter=0;this._timer=this.game.time.now+d};Phaser.Particles.Arcade.Emitter.prototype.emitParticle=function(){var c=this.getFirstExists(false);if(c==null){return}if(this.width>1||this.height>1){c.reset(this.emiteX-this.game.rnd.integerInRange(this.left,this.right),this.emiteY-this.game.rnd.integerInRange(this.top,this.bottom))}else{c.reset(this.emitX,this.emitY)}c.lifespan=this.lifespan;c.body.bounce.setTo(this.bounce,this.bounce);if(this.minParticleSpeed.x!=this.maxParticleSpeed.x){c.body.velocity.x=this.game.rnd.integerInRange(this.minParticleSpeed.x,this.maxParticleSpeed.x)}else{c.body.velocity.x=this.minParticleSpeed.x}if(this.minParticleSpeed.y!=this.maxParticleSpeed.y){c.body.velocity.y=this.game.rnd.integerInRange(this.minParticleSpeed.y,this.maxParticleSpeed.y)}else{c.body.velocity.y=this.minParticleSpeed.y}c.body.gravity.y=this.gravity;if(this.minRotation!=this.maxRotation){c.body.angularVelocity=this.game.rnd.integerInRange(this.minRotation,this.maxRotation)}else{c.body.angularVelocity=this.minRotation}if(this.minParticleScale!==1||this.maxParticleScale!==1){var b=this.game.rnd.realInRange(this.minParticleScale,this.maxParticleScale);c.scale.setTo(b,b)}c.body.drag.x=this.particleDrag.x;c.body.drag.y=this.particleDrag.y};Phaser.Particles.Arcade.Emitter.prototype.setSize=function(c,b){this.width=c;this.height=b};Phaser.Particles.Arcade.Emitter.prototype.setXSpeed=function(c,b){c=c||0;b=b||0;this.minParticleSpeed.x=c;this.maxParticleSpeed.x=b};Phaser.Particles.Arcade.Emitter.prototype.setYSpeed=function(c,b){c=c||0;b=b||0;this.minParticleSpeed.y=c;this.maxParticleSpeed.y=b};Phaser.Particles.Arcade.Emitter.prototype.setRotation=function(c,b){c=c||0;b=b||0;this.minRotation=c;this.maxRotation=b};Phaser.Particles.Arcade.Emitter.prototype.at=function(b){this.emitX=b.center.x;this.emitY=b.center.y};Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"alpha",{get:function(){return this._container.alpha},set:function(b){this._container.alpha=b}});Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"visible",{get:function(){return this._container.visible},set:function(b){this._container.visible=b}});Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"x",{get:function(){return this.emitX},set:function(b){this.emitX=b}});Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"y",{get:function(){return this.emitY},set:function(b){this.emitY=b}});Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"left",{get:function(){return Math.floor(this.x-(this.width/2))}});Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"right",{get:function(){return Math.floor(this.x+(this.width/2))}});Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"top",{get:function(){return Math.floor(this.y-(this.height/2))}});Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"bottom",{get:function(){return Math.floor(this.y+(this.height/2))}});Phaser.Tilemap=function(d,e,b,i,g,h,c){if(typeof g==="undefined"){g=true}if(typeof h==="undefined"){h=0}if(typeof c==="undefined"){c=0}this.game=d;this.group=null;this.name="";this.key=e;this.renderOrderID=0;this.collisionCallback=null;this.exists=true;this.visible=true;this.tiles=[];this.layers=[];var f=this.game.cache.getTilemap(e);PIXI.DisplayObjectContainer.call(this);this.position.x=b;this.position.y=i;this.type=Phaser.TILEMAP;this.renderer=new Phaser.TilemapRenderer(this.game);this.mapFormat=f.format;switch(this.mapFormat){case Phaser.Tilemap.CSV:this.parseCSV(f.mapData,e,h,c);break;case Phaser.Tilemap.JSON:this.parseTiledJSON(f.mapData,e);break}if(this.currentLayer&&g){this.game.world.setSize(this.currentLayer.widthInPixels,this.currentLayer.heightInPixels,true)}};Phaser.Tilemap.prototype=Object.create(PIXI.DisplayObjectContainer.prototype);Phaser.Tilemap.prototype.constructor=Phaser.Tilemap;Phaser.Tilemap.CSV=0;Phaser.Tilemap.JSON=1;Phaser.Tilemap.prototype.parseCSV=function(d,j,h,g){var f=new Phaser.TilemapLayer(this,0,j,Phaser.Tilemap.CSV,"TileLayerCSV"+this.layers.length.toString(),h,g);d=d.trim();var k=d.split("\n");for(var e=0;e 0){f.addColumn(c)}}f.updateBounds();f.createCanvas();var b=f.parseTileOffsets();this.currentLayer=f;this.collisionLayer=f;this.layers.push(f);this.generateTiles(b)};Phaser.Tilemap.prototype.parseTiledJSON=function(g,f){for(var e=0;e 0){this.collisionCallback.call(this.collisionCallbackContext,b,this._tempCollisionData)}return true}else{return false}};Phaser.Tilemap.prototype.putTile=function(b,e,c,d){if(typeof d==="undefined"){d=this.currentLayer.ID}this.layers[d].putTile(b,e,c)};Phaser.Tilemap.prototype.update=function(){this.renderer.render(this)};Phaser.Tilemap.prototype.destroy=function(){this.tiles.length=0;this.layers.length=0};Object.defineProperty(Phaser.Tilemap.prototype,"widthInPixels",{get:function(){return this.currentLayer.widthInPixels}});Object.defineProperty(Phaser.Tilemap.prototype,"heightInPixels",{get:function(){return this.currentLayer.heightInPixels}});Phaser.TilemapLayer=function(f,i,e,d,c,h,b){this.exists=true;this.visible=true;this.widthInTiles=0;this.heightInTiles=0;this.widthInPixels=0;this.heightInPixels=0;this.tileMargin=0;this.tileSpacing=0;this.parent=f;this.game=f.game;this.ID=i;this.name=c;this.key=e;this.type=Phaser.TILEMAPLAYER;this.mapFormat=d;this.tileWidth=h;this.tileHeight=b;this.boundsInTiles=new Phaser.Rectangle();var g=this.game.cache.getTilemap(e);this.tileset=g.data;this._alpha=1;this.canvas=null;this.context=null;this.baseTexture=null;this.texture=null;this.sprite=null;this.mapData=[];this._tempTileBlock=[];this._tempBlockResults=[]};Phaser.TilemapLayer.prototype={putTileWorldXY:function(b,d,c){b=this.game.math.snapToFloor(b,this.tileWidth)/this.tileWidth;d=this.game.math.snapToFloor(d,this.tileHeight)/this.tileHeight;if(d>=0&&d =0&&b =0&&d =0&&b this.widthInPixels||b.body.y<0||b.body.bottom>this.heightInPixels){return this._tempBlockResults}this._tempTileX=this.game.math.snapToFloor(b.body.x,this.tileWidth)/this.tileWidth;this._tempTileY=this.game.math.snapToFloor(b.body.y,this.tileHeight)/this.tileHeight;this._tempTileW=(this.game.math.snapToCeil(b.body.width,this.tileWidth)+this.tileWidth)/this.tileWidth;this._tempTileH=(this.game.math.snapToCeil(b.body.height,this.tileHeight)+this.tileHeight)/this.tileHeight;this.getTempBlock(this._tempTileX,this._tempTileY,this._tempTileW,this._tempTileH,true);for(var c=0;c this.widthInTiles){g=this.widthInTiles}if(c>this.heightInTiles){c=this.heightInTiles}this._tempTileBlock=[];for(var b=h;b =0&&c =0&&b b.widthInTiles){this._maxX=b.widthInTiles}if(this._maxY>b.heightInTiles){this._maxY=b.heightInTiles}if(this._startX+this._maxX>b.widthInTiles){this._startX=b.widthInTiles-this._maxX}if(this._startY+this._maxY>b.heightInTiles){this._startY=b.heightInTiles-this._maxY}this._dx=-(this.game.camera.x-(this._startX*b.tileWidth));this._dy=-(this.game.camera.y-(this._startY*b.tileHeight));this._tx=this._dx;this._ty=this._dy;if(b.alpha!==1){this._ga=b.context.globalAlpha;b.context.globalAlpha=b.alpha}b.context.clearRect(0,0,b.canvas.width,b.canvas.height);for(var f=this._startY;f -1){b.context.globalAlpha=this._ga}if(this.game.renderType==Phaser.WEBGL){PIXI.texturesToUpdate.push(b.baseTexture)}}return true}}; \ No newline at end of file diff --git a/Phaser.sublime-workspace b/Phaser.sublime-workspace index fbb0e982..3cb27ffe 100644 --- a/Phaser.sublime-workspace +++ b/Phaser.sublime-workspace @@ -3,22 +3,70 @@ { "selected_items": [ + [ + "pixel", + "pixelPerfect" + ], + [ + "TILE", + "TILEMAP" + ], + [ + "veg", + "veggies" + ], + [ + "proce", + "processHandler" + ], + [ + "collides", + "collideSpriteVsSprite (function)" + ], + [ + "collideg", + "collideGroupVsTilemap" + ], + [ + "call", + "callbackContext" + ], + [ + "proces", + "processCallback" + ], + [ + "potenti", + "potentials" + ], + [ + "collide", + "collideSpriteVsGroup (function)" + ], + [ + "objec", + "object2 (variable)" + ], + [ + "object", + "object1" + ], + [ + "obj", + "object2" + ], + [ + "ob", + "object1" + ], [ "emit", "emitX" ], - [ - "obj", - "objectOrGroup" - ], [ "callb", "callback (argument)" ], - [ - "call", - "callback" - ], [ "phy", "physicsElapsed" @@ -466,83 +514,11 @@ [ "til", "tilingSprite" - ], - [ - "for", - "forceRestart" - ], - [ - "bot", - "bottomLeft" - ], - [ - "be", - "beginPath" - ], - [ - "show", - "showBounds" - ], - [ - "up", - "updateBounds" - ], - [ - "bottom", - "bottomLeft" - ], - [ - "renderp", - "renderPoint" - ], - [ - "ren", - "renderRectangle (function)" - ], - [ - "sc", - "scaleY" - ], - [ - "frame", - "frameIndex" - ], - [ - "_p", - "_py" - ], - [ - "upda", - "updateOnVisible" ] ] }, "buffers": [ - { - "file": "examples/a_template.php", - "settings": - { - "buffer_size": 640, - "line_ending": "Windows" - } - }, - { - "file": "src/physics/arcade/ArcadePhysics.js", - "settings": - { - "buffer_size": 38650, - "line_ending": "Windows" - } - }, - { - "file": "src/Phaser.js", - "settings": - { - "buffer_size": 488, - "line_ending": "Windows" - } - } ], "build_system": "", "command_palette": @@ -572,30 +548,56 @@ }, "file_history": [ - "/D/wamp/www/phaser/src/particles/arcade/Emitter.js", - "/D/wamp/www/phaser/src/tilemap/Tilemap.js", - "/D/wamp/www/phaser/src/tilemap/TilemapLayer.js", + "/D/wamp/www/phaser/src/core/State.js", + "/D/wamp/www/phaser/examples/a_template.php", + "/D/wamp/www/phaser/examples/state/index.php", + "/D/wamp/www/phaser/src/core/StateManager.js", + "/D/wamp/www/phaser/examples/mariocombo/ohballs.php", + "/D/wamp/www/phaser/examples/state/Game.js", + "/D/wamp/www/phaser/examples/button1.php", + "/D/wamp/www/phaser/examples/state/Preloader.js", + "/D/wamp/www/phaser/examples/state/MainMenu.js", + "/D/wamp/www/phaser/src/input/Input.js", + "/D/wamp/www/phaser/src/core/World.js", "/D/wamp/www/phaser/src/core/Group.js", - "/D/wamp/www/phaser/src/gameobjects/TileSprite.js", + "/D/wamp/www/phaser/src/core/LinkedList.js", + "/D/wamp/www/phaser/examples/text1.php", + "/D/wamp/www/phaser/src/pixi/text/Text.js", + "/D/wamp/www/phaser/src/gameobjects/Sprite.js", + "/D/wamp/www/phaser/src/gameobjects/GameObjectFactory.js", "/D/wamp/www/phaser/src/gameobjects/Text.js", + "/D/wamp/www/phaser/examples/state/js.php", + "/D/wamp/www/phaser/examples/sprite_extend.php", + "/D/wamp/www/phaser/examples/flow6.php", + "/D/wamp/www/phaser/src/input/InputHandler.js", + "/D/wamp/www/phaser/TS Source/gameobjects/TransformManager.ts", + "/D/wamp/www/phaser/TS Tests/input/drag sprite 3.ts", + "/D/wamp/www/phaser/examples/drag.php", + "/D/wamp/www/phaser/TS Tests/input/snap 1.ts", + "/D/wamp/www/phaser/src/physics/arcade/ArcadePhysics.js", + "/D/wamp/www/phaser/examples/supermario2.php", + "/D/wamp/www/phaser/examples/mariocombo/particles.php", + "/D/wamp/www/phaser/build/build.php", + "/D/wamp/www/phaser/examples/collision_group_vs_group.php", + "/D/wamp/www/phaser/src/physics/arcade/Body.js", + "/D/wamp/www/phaser/src/particles/arcade/Emitter.js", + "/D/wamp/www/phaser/examples/collision_sprite_vs_sprite_custom_process.php", + "/D/wamp/www/phaser/src/tilemap/TilemapLayer.js", + "/D/wamp/www/phaser/src/tilemap/Tilemap.js", + "/D/wamp/www/phaser/src/math/QuadTree.js", + "/D/wamp/www/phaser/src/Phaser.js", + "/D/wamp/www/phaser/src/gameobjects/TileSprite.js", "/D/wamp/www/phaser/src/gameobjects/RenderTexture.js", "/D/wamp/www/phaser/src/gameobjects/Graphics.js", "/D/wamp/www/phaser/src/gameobjects/Button.js", - "/D/wamp/www/phaser/src/gameobjects/Sprite.js", - "/D/wamp/www/phaser/src/physics/arcade/ArcadePhysics.js", "/D/wamp/www/phaser/examples/statetest.php", "/D/wamp/www/phaser/src/tilemap/Tile.js", "/D/wamp/www/phaser/src/utils/Debug.js", - "/D/wamp/www/phaser/examples/mariocombo/particles.php", - "/D/wamp/www/phaser/src/physics/arcade/Body.js", "/D/wamp/www/phaser/examples/mariocombo/index.php", - "/D/wamp/www/phaser/examples/a_template.php", "/D/wamp/www/phaser/examples/particles.php", "/D/wamp/www/phaser/src/time/Time.js", "/D/wamp/www/phaser/src/math/Math.js", "/D/wamp/www/phaser/src/core/Game.js", - "/D/wamp/www/phaser/src/core/World.js", - "/D/wamp/www/phaser/src/gameobjects/GameObjectFactory.js", "/D/wamp/www/phaser/src/system/StageScaleMode.js", "/D/wamp/www/phaser/examples/js.php", "/D/wamp/www/phaser/TS Source/physics/aabb/ProjAABB22Deg.js", @@ -623,8 +625,6 @@ "/D/wamp/www/phaser/src/animation/FrameData.js", "/D/wamp/www/phaser/src/gameobjects/Bullet.js", "/D/wamp/www/phaser/examples/pixelpick3.php", - "/D/wamp/www/phaser/src/input/InputHandler.js", - "/D/wamp/www/phaser/src/input/Input.js", "/D/wamp/www/phaser/src/core/Stage.js", "/D/wamp/www/phaser/examples/sprite3.php", "/D/wamp/www/phaser/examples/world.php", @@ -636,12 +636,10 @@ "/D/wamp/www/phaser/src/sound/Sound.js", "/D/wamp/www/phaser/src/sound/SoundManager.js", "/D/wamp/www/phaser/src/utils/Color.js", - "/D/wamp/www/phaser/src/core/LinkedList.js", "/D/wamp/www/phaser/examples/group1.php", "/D/wamp/www/phaser/src/geom/Point.js", "/D/wamp/www/phaser/src/input/Pointer.js", "/D/wamp/www/phaser/src/gameobjects/BitmapText.js", - "/D/wamp/www/phaser/src/core/StateManager.js", "/D/wamp/www/phaser/src/animation/Parser.js", "/D/wamp/www/phaser/src/animation/AnimationManager.js", "/D/wamp/www/phaser/src/animation/Animation.js", @@ -664,7 +662,6 @@ "/D/wamp/www/phaser/TS Source/tilemap/Tilemap.js", "/D/wamp/www/phaser/TS Source/loader/Loader.ts", "/D/wamp/www/phaser/TS Source/loader/Cache.ts", - "/D/wamp/www/phaser/examples/sprite_extend.php", "/D/wamp/www/phaser/TS Source/gameobjects/ScrollZone.js", "/D/wamp/www/phaser/TS Source/display/CSS3Filters.js", "/D/wamp/www/phaser/plugins/CSS3Filters.js", @@ -676,30 +673,9 @@ "/D/wamp/www/phaser/examples/assets/fonts/desyrel.xml", "/D/wamp/www/phaser/src/tween/Tween.js", "/D/wamp/www/phaser/src/tween/TweenManager.js", - "/D/wamp/www/phaser/src/core/State.js", "/D/wamp/www/phaser/src/input/Keyboard.js", "/D/wamp/www/phaser/src/gameobjects/Events.js", - "/D/wamp/www/phaser/examples/input2.php", - "/D/wamp/www/phaser/src/input/MSPointer.js", - "/D/wamp/www/phaser/src/pixi/renderers/canvas/CanvasRenderer.js", - "/D/wamp/www/phaser/src/pixi/renderers/webgl/WebGLRenderer.js", - "/D/wamp/www/phaser/src/pixi/InteractionManager.js", - "/D/wamp/www/phaser/src/input/Mouse.js", - "/D/wamp/www/phaser/examples/stagecolor.php", - "/D/wamp/www/phaser/plugins/ColorHarmony.js", - "/D/wamp/www/phaser/src/utils/ColorUtils.js", - "/D/wamp/www/phaser/TS Source/utils/ColorUtils.js", - "/D/wamp/www/phaser/examples/bringToTop3.php", - "/D/wamp/www/phaser/examples/bring to top2.php", - "/D/wamp/www/phaser/examples/bring to top.php", - "/D/wamp/www/phaser/src/utils/Utils.js", - "/D/wamp/www/phaser/examples/assets/sprites/pixi_monsters.json", - "/D/wamp/www/phaser/src/particles/Particles.js", - "/D/wamp/www/phaser/src/math/RandomDataGenerator.js", - "/D/wamp/www/phaser/src/particles/arcade/ArcadeParticles.js", - "/D/wamp/www/phaser/src/system/Device.js", - "/D/wamp/www/phaser/src/pixi/primitives/Graphics.js", - "/D/wamp/www/phaser/examples/graphics.php" + "/D/wamp/www/phaser/examples/input2.php" ], "find": { @@ -739,6 +715,34 @@ "case_sensitive": true, "find_history": [ + "MainMenu", + "../src", + "Preloader", + "MonsterBunny", + "dragFromCenter", + "onDrag", + "snapX", + "pixelPerfect", + "lockCenter", + ";\n", + "p.", + "velocity", + "game.camera", + "64", + "32", + "X", + "this._potentials[i].sprite", + "collide", + "_obj2NewVelocity", + "_obj1NewVelocity", + "_obj2Velocity", + "_obj1Velocity", + "this.bounds2", + "_obj2Bounds", + "obj1Bounds", + "object", + "object1", + "this", "maps/", "Phaser.Group", "this", @@ -838,35 +842,7 @@ "this._tempState", ": ", "= ", - ": ", - "this.sprite", - ": ", - "parent", - "this._parent", - "_parent.events", - "console.log", - ": ", - ",", - "sound", - "soundHasUnlocked", - "locked", - "console.log", - "this.game.stage.canvas", - "stage.width", - "stage.canvas", - "Phaser.ColorUtils", - "ColorUtils", - "ColorUtils.", - "sonic", - "utils", - "carrot", - "game.add.child", - "float", - "Phaser.Sprite.prototype", - "i", - "active", - "key", - "star2" + ": " ], "highlight": true, "in_selection": false, @@ -874,6 +850,15 @@ "regex": false, "replace_history": [ + "../../src", + "_newVelocity2", + "_newVelocity1", + "_velocity2", + "_velocity1", + "this._bounds2", + "bounds2", + "bounds1", + "body", " = function", "CSV", "JSON", @@ -990,401 +975,8 @@ "groups": [ { - "selected": 2, "sheets": [ - { - "buffer": 0, - "file": "examples/a_template.php", - "settings": - { - "buffer_size": 640, - "regions": - { - }, - "selection": - [ - [ - 0, - 0 - ] - ], - "settings": - { - "codeintel": true, - "codeintel_config": - { - "JavaScript": - { - "codeintel_max_recursive_dir_depth": 2, - "codeintel_scan_files_in_project": false, - "javascriptExtraPaths": - [ - ] - }, - "PHP": - { - "codeintel_max_recursive_dir_depth": 5, - "codeintel_scan_files_in_project": false, - "phpExtraPaths": - [ - ] - }, - "Python": - { - "env": - { - } - } - }, - "codeintel_enabled_languages": - [ - "JavaScript", - "Mason", - "XBL", - "XUL", - "RHTML", - "SCSS", - "Python", - "HTML", - "Ruby", - "Python3", - "XML", - "Sass", - "XSLT", - "Django", - "HTML5", - "Perl", - "CSS", - "Twig", - "Less", - "Smarty", - "Node.js", - "Tcl", - "TemplateToolkit", - "PHP" - ], - "codeintel_live": true, - "codeintel_live_enabled_languages": - [ - "JavaScript", - "Mason", - "XBL", - "XUL", - "RHTML", - "SCSS", - "Python", - "HTML", - "Ruby", - "Python3", - "XML", - "Sass", - "XSLT", - "Django", - "HTML5", - "Perl", - "CSS", - "Twig", - "Less", - "Smarty", - "Node.js", - "Tcl", - "TemplateToolkit", - "PHP" - ], - "codeintel_max_recursive_dir_depth": 10, - "codeintel_scan_exclude_dir": - { - "JavaScript": - [ - "/build/", - "/min/" - ] - }, - "codeintel_scan_files_in_project": true, - "codeintel_selected_catalogs": - [ - "PyWin32", - "jQuery", - "Rails" - ], - "codeintel_snippets": true, - "codeintel_syntax_map": - { - "Python Django": "Python" - }, - "sublime_auto_complete": true, - "syntax": "Packages/PHP/PHP.tmLanguage", - "tab_size": 4, - "translate_tabs_to_spaces": true - }, - "translation.x": 0.0, - "translation.y": 0.0, - "zoom_level": 1.0 - }, - "type": "text" - }, - { - "buffer": 1, - "file": "src/physics/arcade/ArcadePhysics.js", - "settings": - { - "buffer_size": 38650, - "regions": - { - }, - "selection": - [ - [ - 474, - 474 - ] - ], - "settings": - { - "codeintel": true, - "codeintel_config": - { - "JavaScript": - { - "codeintel_max_recursive_dir_depth": 2, - "codeintel_scan_files_in_project": false, - "javascriptExtraPaths": - [ - ] - }, - "PHP": - { - "codeintel_max_recursive_dir_depth": 5, - "codeintel_scan_files_in_project": false, - "phpExtraPaths": - [ - ] - }, - "Python": - { - "env": - { - } - } - }, - "codeintel_enabled_languages": - [ - "JavaScript", - "Mason", - "XBL", - "XUL", - "RHTML", - "SCSS", - "Python", - "HTML", - "Ruby", - "Python3", - "XML", - "Sass", - "XSLT", - "Django", - "HTML5", - "Perl", - "CSS", - "Twig", - "Less", - "Smarty", - "Node.js", - "Tcl", - "TemplateToolkit", - "PHP" - ], - "codeintel_live": true, - "codeintel_live_enabled_languages": - [ - "JavaScript", - "Mason", - "XBL", - "XUL", - "RHTML", - "SCSS", - "Python", - "HTML", - "Ruby", - "Python3", - "XML", - "Sass", - "XSLT", - "Django", - "HTML5", - "Perl", - "CSS", - "Twig", - "Less", - "Smarty", - "Node.js", - "Tcl", - "TemplateToolkit", - "PHP" - ], - "codeintel_max_recursive_dir_depth": 10, - "codeintel_scan_exclude_dir": - { - "JavaScript": - [ - "/build/", - "/min/" - ] - }, - "codeintel_scan_files_in_project": true, - "codeintel_selected_catalogs": - [ - "PyWin32", - "jQuery", - "Rails" - ], - "codeintel_snippets": true, - "codeintel_syntax_map": - { - "Python Django": "Python" - }, - "sublime_auto_complete": true, - "syntax": "Packages/JavaScript/JavaScript.tmLanguage", - "tab_size": 4, - "translate_tabs_to_spaces": true - }, - "translation.x": 0.0, - "translation.y": 0.0, - "zoom_level": 1.0 - }, - "type": "text" - }, - { - "buffer": 2, - "file": "src/Phaser.js", - "settings": - { - "buffer_size": 488, - "regions": - { - }, - "selection": - [ - [ - 287, - 287 - ] - ], - "settings": - { - "codeintel": true, - "codeintel_config": - { - "JavaScript": - { - "codeintel_max_recursive_dir_depth": 2, - "codeintel_scan_files_in_project": false, - "javascriptExtraPaths": - [ - ] - }, - "PHP": - { - "codeintel_max_recursive_dir_depth": 5, - "codeintel_scan_files_in_project": false, - "phpExtraPaths": - [ - ] - }, - "Python": - { - "env": - { - } - } - }, - "codeintel_enabled_languages": - [ - "JavaScript", - "Mason", - "XBL", - "XUL", - "RHTML", - "SCSS", - "Python", - "HTML", - "Ruby", - "Python3", - "XML", - "Sass", - "XSLT", - "Django", - "HTML5", - "Perl", - "CSS", - "Twig", - "Less", - "Smarty", - "Node.js", - "Tcl", - "TemplateToolkit", - "PHP" - ], - "codeintel_live": true, - "codeintel_live_enabled_languages": - [ - "JavaScript", - "Mason", - "XBL", - "XUL", - "RHTML", - "SCSS", - "Python", - "HTML", - "Ruby", - "Python3", - "XML", - "Sass", - "XSLT", - "Django", - "HTML5", - "Perl", - "CSS", - "Twig", - "Less", - "Smarty", - "Node.js", - "Tcl", - "TemplateToolkit", - "PHP" - ], - "codeintel_max_recursive_dir_depth": 10, - "codeintel_scan_exclude_dir": - { - "JavaScript": - [ - "/build/", - "/min/" - ] - }, - "codeintel_scan_files_in_project": true, - "codeintel_selected_catalogs": - [ - "PyWin32", - "jQuery", - "Rails" - ], - "codeintel_snippets": true, - "codeintel_syntax_map": - { - "Python Django": "Python" - }, - "sublime_auto_complete": true, - "syntax": "Packages/JavaScript/JavaScript.tmLanguage", - "translate_tabs_to_spaces": false - }, - "translation.x": 0.0, - "translation.y": 0.0, - "zoom_level": 1.0 - }, - "type": "text" - } ] } ], diff --git a/README.md b/README.md index a2762b7a..1ced5b6c 100644 --- a/README.md +++ b/README.md @@ -1,271 +1,37 @@ Phaser ====== -Version: 1.0.0 - Released: August 2013 +Version: 1.0.0 - Released: September 13th 2013 By Richard Davey, [Photon Storm](http://www.photonstorm.com) -Phaser is a 2D JavaScript/TypeScript HTML5 Game Framework based heavily on [Flixel](http://www.flixel.org). +Phaser is a fast, free and fun open source game framework for making desktop and mobile browser HTML5 games. It supports Canvas and WebGL rendering. +The [Official Website](http://phaser.io)
Follow on [Twitter](https://twitter.com/photonstorm)
Read the [Development Blog](http://www.photonstorm.com)
Join the [Support Forum](http://www.html5gamedevs.com/forum/14-phaser/) Try out the [Phaser Test Suite](http://gametest.mobi/phaser/) - - "Being negative is not how we make progress" - Larry Page, Google -Known Issues ------------- - -* The TypeScript 0.9.1 compiler is NOT production ready and is full of bugs. I tried my best to support it but I can't in all honesty -recommend it to anyone, so have reverted back to TypeScript 0.8.3 which works flawlessly. Sorry everyone. I'll try upgrading again in -the future when they sort it out. - -* Input detection on Sprites/Buttons doesn't work if the CAMERA is rotated or scaled. - -Future Plans ------------- - -* Ability to layer another DOM object and have it controlled by the game somehow. Can then do stacked canvas effects. -* Add ability to create extras within the game container, layered above/below the canvas -* Basic Window UI component (maybe a propogating Group?) -* Add clip support + shape options to Texture Component. -* Tilemap: remove tiles of a certain type, replace tile with sprite, change layer order, Tiled object support. -* Joypad support. -* Gestures input class. -* Integrate the Advanced Physics system that is 90% ready but needs updating for TypeScript 0.9.1. - - -ToDo before release -------------------- - -* Move embedded Phaser logo outside or swap for canvas calls -* Put Device.getAll elsewhere (plugin? utils?) -* Investigate bug re: tilemap collision and animation frames -* Sprite collision events -* Check bounds/edge points when sprite is only 1x1 sized :) -* QuadTree.physics.checkHullIntersection -* Sprite.transform.bottomRight/Left doesn't seem to take origin into account -* When game paused should mute-all then resume-all sounds? -* Bitmap Font support -* Pixel-perfect click check -* Check Flash atlas export is working -* DynamicTexture.setPixel needs to be swapped for a proper pixel put, not the filledRect it currently is. -* Check multi-game support (2+ games on one page) -* Finish the Docs! -* Getting Started guide! -* Sprite Sheet / Atlas support for Dynamic Textures -* Check browser support: OS X and iOS7 + Chrome Android latest -* Tweening + collision - what happens? - - -Mobile Optimisation Suggestions -------------------------------- - -* Camera.directToStage -* Stage.clear - Latest Update ------------- -V1.0.0 +September 13th 2013 -* Massive refactoring across the entire codebase. -* Removed Basic and GameObject and put Sprite on a diet. 127 properties and methods cut down to 32. -* Added a new headless renderer for non-display related performance testing. -* Added camera type to the CameraManager for future non-orthographic cameras. -* Added Camera.destroy - now clears down the FX and unregisters itself from the CameraManager. -* Added Camera.hide/show to hide Sprites or Groups from rendering (and removed corresponding hideFromCamera methods from Sprites/Groups) -* Heavily optimised Group so it no longer creates any temporary variables in any methods. -* Added Game.renderer which can be HEADLESS, CANVAS or WEBGL (coming soon) -* Added Sprite.render which is a reference to IRenderer.renderSprite, but can be overridden for custom handling. -* Refactored QuadTree so it no longer creates any temporary variables in any methods. -* The Sprite Renderer now uses a single setTransform for scale, rotation and translation that respects the Sprite.origin value in all cases. -* Sprite.modified is set to true if scale, rotation, skew or flip have been used. -* Added Tween.loop property so they can now re-run themselves indefinitely. -* Added Tween.yoyo property so they can reverse themselves after completing. -* Added Gravity to the Physics component. -* Removed Sprite.angle - use Sprite.rotation instead -* Optimised separateX/Y and overlap so they don't use any temporary vars any more. -* Added the new Physics.Body object to all Sprites. Used for all physics calculations in-game. Will be extended for Fixtures/Joints in future. -* Added SpriteUtils.setOriginToCenter to quickly set the origin of a sprite based on either frameBounds or body.bounds -* Added Sprite.Input component for tracking Input events over a Sprite -* Added Sprite.Input.useHandCursor (for desktop) -* Added Sprite.Input.justOver and justOut with a configurable ms delay -* Added Sprite.Events component for a global easy to access area to listen to events from -* Added Group.ID, each Group has a unique ID. Added Sprite.group (and Group.group) which is a reference to the Group it was added to. -* Added Group.addNewSprite(x,y,key) for quick addition of new Sprites to a Group -* Fixed Group.sort so the sortHandler is called correctly -* Added Group.swap(a,b) to swap the z-index of 2 objects with optional rendering update boolean -* Sprites dispatch new events for: killed, revived, added to Group and removed from Group. -* Added Input drag, bounds, sprite bounds and snapping support. -* Added the new ColorUtils class full of lots of handy color manipulation functions. -* Fixed issue in Camera.inCamera check where it wouldn't take into consideration the Sprites scrollFactor. -* Fixed issue with JSON Atlas loader incorrectly parsing the frames array. -* Fixed bug in FrameData.getFrameByName where the first frame of the array would always be skipped. -* Fixed bug where the Stage.backgroundColor property wasn't being saved correctly. -* Made Stage.bootScreen and Stage.pauseScreen public so you can override them with your own States now. -* Added the new OrientationScreen and Stage.enableOrientationCheck to allow for easy 'portrait/landscape only' game handling. -* Added fix to StageScaleMode for 180 degree portrait orientation on iPad. -* Added fix to orientation check so that it updates the input offsets correctly on rotation. -* Added support for minWidth and minHeight to game scale size, so it can never go below those values when scaling. -* Vastly improved orientation detection and response speed. -* Added custom callback support for all Touch and Mouse Events so you can easily hook events to custom APIs. -* Updated Game.loader and its methods. You now load images by: game.load.image() and also: game.load.atlas, game.load.audio, game.load.spritesheet, game.load.text. And you start it with game.load.start(). -* Added optional frame parameter to Phaser.Sprite (and game.add.sprite) so you can set a frame ID or frame name on construction. -* Fixed bug where passing a texture atlas string would incorrectly skip the frames array. -* Added AnimationManager.autoUpdateBounds to control if a new frame should change the physics bounds of a sprite body or not. -* Added StageScaleMode.pageAlignHorizontally and pageAlignVertically booleans. When true Phaser will set the margin-left and top of the canvas element so that it is positioned in the middle of the page (based only on window.innerWidth). -* Added support for globalCompositeOperation, opaque and backgroundColor to the Sprite.Texture and Camera.Texture components. -* Added ability for a Camera to skew and rotate around an origin. -* Moved the Camera rendering into CanvasRenderer to keep things consistent. -* Added Stage.setImageRenderingCrisp to quickly set the canvas image-rendering to crisp-edges (note: poor browser support atm) -* Sprite.width / height now report the scaled width height, setting them adjusts the scale as it does so. -* Created a Transform component containing scale, skew, rotation, scrollFactor, origin and rotationOffset. Added to Sprite, Camera, Group. -* Created a Texture component containing image data, alpha, flippedX, flippedY, etc. Added to Sprite, Camera, Group. -* Added CameraManager.swap and CameraManager.sort methods and added a z-index property to Camera to control render order. -* Added World.postUpdate loop + Group and Camera postUpdate methods. -* Fixed issue stopping Pointer from working in world coordinates and fixed the world drag example. -* For consistency renamed input.scaledX/Y to input.scale. -* Added input.activePointer which contains a reference to the most recently active pointer. -* Sprite.Transform now has upperLeft, upperRight, bottomLeft and bottomRight Point properties and lots of useful coordinate related methods. -* Camera.inCamera check now uses the Sprite.worldView which finally accurately updates regardless of scale, rotation or rotation origin. -* Added Math.Mat3 for Matrix3 operations (which Sprite.Transform uses) and Math.Mat3Utils for lots of use Mat3 related methods. -* Added SpriteUtils.overlapsXY and overlapsPoint to check if a point is within a sprite, taking scale and rotation into account. -* Added Cache.getImageKeys (and similar) to return an array of all the keys for all currently cached objects. -* Added Group.bringToTop feature. Will sort the Group, move the given sprites z-index to the top and shift the rest down by one. -* Brand new Advanced Physics system added and working! Woohoo :) -* Fixed issue in Tilemap.parseTiledJSON where it would accidentally think image and object layers were map data. -* Fixed bug in Group.bringToTop if the child didn't have a group property yet. -* Fixed bug in FrameData.checkFrameName where the first index of the _frameNames array would be skipped. -* Added isRunning boolean property to Phaser.Tween -* Moved 'facing' property from Sprite.body to Sprite.texture (may move to Sprite core) -* Added Sprite.events.onDragStart and onDragStop -* A tilemap can now be loaded without a tile sheet, should you just want to get the tile data from it and not render. -* Added new Sprite.events: onAnimationStart, onAnimationComplete, onAnimationLoop -* Added in support for the Input component PriorityID value and refactored Input.Pointer to respect it. Rollovers are perfect now :) -* Added 2 new State functions: loadRender and loadUpdate, are called the same as render and update but only during the load process -* Fixed Input.stopDrag so it fires an onInputUp event as well from the sprite. -* Added support for a preRender state - very useful for certain types of special effects. -* Cameras are now limited so they can never be larger than the Game.Stage size. -* Added a new Button Game Object for easily creating in-game UI and menu systems. -* Fixed bug where Sprite.alpha wasn't properly reflecting Sprite.texture.alpha. -* Fixed bug where the hand cursor would be reset on input up, even if the mouse was still over the sprite. -* Fixed bug where pressing down then moving out of the sprite area wouldn't properly reset the input state next time you moved over the sprite. -* Added the Sprite.tween property, really useful to avoid creating new tween vars in your local scope if you don't need them. -* Added support for pagehide and pageshow events to Stage, hooked in to the pause/resume game methods. -* Extended Device audio checks to include opus and webm. -* Updated Loader and Cache so they now support loading of Audio() tags as well as Web Audio. -* Set Input.recordPointerHistory to false, you now need to enable the pointer tracking if you wish to use it. -* SoundManager will now automatically handle iOS touch unlocking. -* Added TilemapLayer.putTileWorldXY to place a tile based on pixel values, and putTile based on tile map coordinates. -* Dropped the StageScaleMode.setScreenSize iterations count from 40 down to 10 and document min body height to 2000px. -* Added Phaser.Net for browser and network specific functions, currently includes query string parsing and updating methods. -* Added a new CSS3 Filters component. Apply blur, grayscale, sepia, brightness, contrast, hue rotation, invert, opacity and saturate filters to the games stage. -* Fixed the CircleUtils.contains and containsPoint methods. -* Fixed issue with Input.speed values being too high on new touch events. -* Added Sprite.bringToTop() -* Added Stage.disableVisibilityChange to stop the auto pause/resume from ever firing. -* Added crop support to the Texture component, so you can do Sprite.crop to restrict rendering to a specified Rectangle without distortion. -* Added references to all the event listener functions so they can be cleanly destroyed. -* Fixed interesting Firefox issue when an audio track ended it fired another 'canplaythrough' event, confusing the Loader. -* Added the new PluginManager. Moved all the Camera FX over to plugins. Everything will be a plugin from now on. -* Added Sprite.transform.centerOn(x,y) to quickly center a sprite on a coordinate without messing with the sprite origin and regardless of rotation. -* Added Input.pollRate - this lets you limit how often Pointer events are handled (0 = every frame, 1 = every other frame, etc) -* Renamed the 'init' function to 'preload'. It now calls load.start automatically. -* Added CanvasUtils class, including ability to set image rendering, add a canvas to the dom and other handy things. +We're very pleased to have finally shipped the 1.0 release of Phaser. This version represents many months of hard work, feedback and refactoring based on the previous 0.5 through to 0.97 releases. You can see the full gory details in our change log. +Sorry but the jsdocs aren't yet finished, but it is now our priority (along with bug fixing). If you run into problems, or just want to chat about how to best use Phaser then please do join our forums. It's an active and inspiring community. -V0.9.6 +Now 1.0 is released we'll focus on getting the docs and more examples completed. Both of these will be pushed to the master repo on a regular basis. We will tag new releases of Phaser, but changes to the examples or docs won't be release tagged. -* Virtually every class now has documentation - if you spot a typo or something missing please shout (thanks pixelpicosean). -* Grunt file updated to produce the new Special FX JS file (thanks HackManiac). -* Fixed issue stopping Phaser working on iOS 5 (iPad 1). -* Created new mobile test folder, updated index.php to use mobile CSS and made some mobile specific tests. -* Fixed a few speed issues on Android 2.x stock browser. -* Moved Camera context save/restore back inside parameter checks (sped-up Samsung S3 stock browser). -* Fixed bug with StageScaleMode.checkOrientation not respecting the NO_SCALE value. -* Added MSPointer support (thanks Diego Bezerra). -* Added Camera.clear to perform a clearRect instead of a fillRect if needed (default is false). -* Swapped Camera.opaque default from true to false re: performance. -* Updated Stage.visibilityChange to avoid pause screen locking in certain situations. -* Added StageScaleMode.enterLandscape and enterPortrait signals for easier device orientation change checks. -* Added StageScaleMode.isPortrait. -* Updated StageScaleMode to check both window.orientationchange and window.resize events. -* Updated RequestAnimationFrame to use performance.now for sub-millisecond precision and to drive the Game.time.update loop. -* Updated RequestAnimationFrame setTimeout to use fixed timestep and re-ordered callback sequence. Android 2/iOS5 performance much better now. -* Removed Stage.ORIENTATION_LANDSCAPE statics because the values should be taken from Stage.scale.isPortrait / isLandscape. -* Removed Stage.maxScaleX/Y and moved them into StageScaleMode.minWidth, minHeight, maxWidth and maxHeight. -* Fixed Stage.scale so that it resizes without needing an orientation change first. -* Added StageScaleMode.startFullscreen(), stopFullScreen() and isFullScreen for making use of the FullScreen API on desktop browsers. -* Swapped Stage.offset from Point to MicroPoint. -* Swapped Stage.bounds from Rectangle to Quad. -* Added State.destroy support. A states destroy function is called when you switch to a new state (thanks JesseFreeman). -* Added Sprite.fillColor, used in the Sprite render if no image is loaded (set via the property or Sprite.makeGraphic) (thanks JesseFreeman). -* Renamed Phaser.Finger to Phaser.Pointer. -* Updated all of the Input classes so they now use Input.pointers 1 through 10. -* Updated Touch and MSPointer to allow multi-touch support (when the hardware supports it) and created new tests to show this. -* Added Input.getPointer, Input.getPointerFromIdentifier, Input.totalActivePointers and Input.totalInactivePointers. -* Added Input.startPointer, Input.updatePointer and Input.stopPointer. -* Phaser Input now confirmed working on Windows Phone 8 (Nokia Lumia 920). -* Added Input.maxPointers to allow you to limit the number of fingers your game will listen for on multi-touch systems. -* Added Input.addPointer. By default Input will create 5 pointers (+1 for the mouse). Use addPointer() to add up to a maximum of 10. -* Added Input.position - a Vector2 object containing the most recent position of the most recently active Pointer. -* Added Input.getDistance. Find the distance between the two given Pointer objects. -* Added Input.getAngle. Find the angle between the two given Pointer objects. -* Pointer.totalTouches value keeps a running total of the number of times the Pointer has been pressed. -* Added Pointer.position and positionDown. positionDown is placed on touch and position is update on move, useful for tracking distance/direction/gestures. -* Added Game.state - now contains a reference to the current state object (if any was given). -* Moved the Input start events from the constructors to a single Input.start method. -* Added Input.disabled boolean to globally turn off all input event processing. -* Added Input.Mouse.disabled, Input.Touch.disabled, Input.MSPointer.disabled and Input.Keyboard.disabled. -* Added Device.mspointer boolean. true if MSPointer is available on the device. -* Added Input.onDown, onUp, onTap, onDoubleTap and onHold signals - all fired by the mouse or touch. -* Added Input.recordPointerHistory to record the x/y coordinates a Pointer tracks through. Also Input.recordRate and Input.recordLimit for fine control. -* Added Input.multiInputOverride which can be MOUSE_OVERRIDES_TOUCH, TOUCH_OVERRIDES_MOUSE or MOUSE_TOUCH_COMBINE. -* Added GameObject.setBoundsFromWorld to quickly set the bounds of a game object to match those of the current game world. -* Added GameObject.canvas and GameObject.context. By default they reference Stage.canvas but can be changed to anything, i.e. a DynamicTexture -* The new canvas and context references are applied to Sprite, GeomSprite and TilemapLayer -* Added DynamicTexture.assignCanvasToGameObjects() to allow you to redirect GameObject rendering en-mass to a DynamicTexture -* Added DynamicTexture.render(x,y) to render the texture to the Stage canvas -* Added Basic.ignoreGlobalUpdate - stops the object being updated as part of the main game loop, you'll need to call update on it yourself -* Added Basic.ignoreGlobalRender - stops the object being rendered as part of the main game loop, you'll need to call render on it yourself -* Added forceUpdate and forceRender parameters to Group.update and Group.render respectively. Combined with ignoreGlobal you can create custom rendering set-ups -* Fixed Loader.progress calculation so it now accurately passes a value between 0 and 100 to your loader callback -* Added a 'hard reset' parameter to Input.reset. A hard reset clears Input signals (such as on a state swap), a soft (such as on game pause) doesn't -* Added Device.isConsoleOpen() to check if the browser console is open. Tested on Firefox with Firebug and Chrome with DevTools -* Added delay parameter to Tween.to() -* Fixed bug where GeomSprite.renderOutline was being ignored for Circle objects -* Fixed bug with GeomSprite circles rendering at twice the size they should have been and offset from actual x/y values -* Added Sprite.cacheKey which stores the key of the item from the cache that was used for its texture (if any) -* Added GameMath.shuffleArray -* Updated Animation.frame to return the index of the currentFrame if set -* Added Quad.copyTo and Quad.copyFrom -* Removed the bakedRotations parameter from Emiter.makeParticles - update your code accordingly! -* Updated various classes to remove the Flixel left-over CamelCase parameters -* Updated QuadTree to use the new CollisionMask values and significantly optimised and reduced overall class size -* Updated Collision.seperate to use the new CollisionMask -* Added a callback context parameter to Game.collide, Collision.overlap and the QuadTree class -* Stage.canvas now calls preventDefault() when the context menu is activated (oncontextmenu) -* Added Point.rotate to allow you to rotate a point around another point, with optional distance clamping. Also created test cases. -* Added Group.alpha to apply a globalAlpha before the groups children are rendered. Useful to save on alpha calls. -* Added Group.globalCompositeOperation to apply a composite operation before all of the groups children are rendered. -* Added Camera black list support to Sprite and Group along with Camera.show, Camera.hide and Camera.isHidden methods to populate them. -* Added GameMath.rotatePoint to allow for point rotation at any angle around a given anchor and distance -* Updated World.setSize() to optionally update the VerletManager dimensions as well -* Added GameObject.setPosition(x, y) -* Added Quad.intersectsRaw(left, right, top, bottom, tolerance) -* Updated Sprite.inCamera to correctly apply the scrollFactor to the camera bounds check -* Added Loader.crossOrigin property which is applied to loaded Images -* Added AnimationManager.destroy() to clear out all local references and objects -* Added the clearAnimations parameter to Sprite.loadGraphic(). Allows you to change animation textures but retain the frame data. -* Added the GameObjectFactory to Game. You now make Sprites like this: game.add.sprite(). Much better separation of game object creation methods now. But you'll have to update ALL code, sorry! (blame JesseFreeman for breaking your code and coming up with the idea :) -* Added GameObjectFactory methods to add existing objects to the game world, such as existingSprite(), existingTween(), etc. -* Added the GameObjectFactory to Phaser.State -* Added new format parameter to Loader.addTextureAtlas defining the format. Currently supported: JSON Array and Starling/Sparrow XML. +Thank you to everyone who has encouraged us along the way. To those of you who worked with Phaser during its various incarnations, and who released full games with it despite there being zero API documentation available: you are our heroes. It's your kind words and enthusiasm, as well as our commercial need for Phaser that has kept us going. Now we're at 1.0 we will continue releasing rapidly and jumping on patches and bug reports quickly. + +Phaser is everything we ever wanted from an HTML5 game framework. It will power all our client work going forward and we look forward to you joining us on this journey. + + Requirements ------------ @@ -274,20 +40,16 @@ Games created with Phaser require a modern web browser that supports the canvas For developing with Phaser you can use either a plain-vanilla JavaScript approach or [TypeScript](https://typescript.codeplex.com/). We made no assumptions about how you like to code your games, and were careful not to impose any form of class/inheritance/structure upon you. -If you are compiling via TypeScript from the command-line please use `--target ES5` - -If you need it the included Grunt file will generate a RequireJS/CommonJS version of Phaser on build. - -Phaser is just 45KB gzipped and minified. +Phaser is 275 KB minified and 62 KB gzipped. Features -------- Phaser was born from a cross-pollination of the AS3 Flixel game library and our own internal HTML5 game framework. The objective was to allow you to make games _really_ quickly and remove some of the speed barriers HTML5 puts in your way. -Phaser fully or partially supports the following features. This list is growing constantly and we are aware there are still a number of essential features missing: +Phaser fully supports the following features: -* Asset Loading
+* Easy asset Loading
Images, Sprite Sheets, Texture Packer Data, JSON, Text Files, Audio File. @@ -357,17 +119,25 @@ Phaser fully or partially supports the following features. This list is growing  -Work in Progress ----------------- +Known Issues +------------ -We've a number of features that we know Phaser is lacking, here is our current priority list: +* The TypeScript definition file isn't yet complete. +* The JSDOCS are not yet complete. -* Better sound controls -* Text Rendering -* Buttons -* Google Play Game Services +Future Plans +------------ -Beyond this there are lots of other things we plan to add such as WebGL support, Spine animation format support, sloped collision tiles, path finding and support for custom plugins. But the list above are priority items, and by no means exhaustive either! However we do feel that the core structure of Phaser is now tightly locked down, so safe to use for small scale production games. +* Ability to layer another DOM object and have it controlled by the game somehow. Can then do stacked canvas effects. +* Add ability to create extras within the game container, layered above/below the canvas. +* Basic set of GUI components, checkbox, window, etc. +* Tilemap: remove tiles of a certain type, replace tile with sprite, change layer order, Tiled object support. +* Joypad support. +* Gestures input class. +* Integrate Advanced Physics system. +* Integrate Advanced Particles system. +* Better sound controls and effects. +* Google Play Game Services. Test Suite ---------- @@ -378,7 +148,7 @@ The tests need running through a local web server (to avoid file access permissi Make sure you can browse to the Tests folder via your web server. If you've got php installed then launch: - Tests/index.php + examples/index.php Right now the Test Suite requires PHP, but we will remove this requirement soon. @@ -402,127 +172,6 @@ Please add them to the [Issue Tracker][1] with as much info as possible.  -Change Log ----------- - -V0.9.5 - -* Moved the BootScreen and PauseScreen out of Stage into their own classes (system/screens/BootScreen and PauseScreen). -* Updated the PauseScreen to show a subtle animation effect, making it easier to create your own interesting pause screens. -* Modified Game so it splits into 3 loops - bootLoop, pauseLoop and loop (the core loop). -* Updated the BootScreen with the new logo and new color cycle effect. -* Added Game.isRunning - set to true once the Game.boot process is over IF you gave some functions to the constructor or a state. -* Fixed small bug in Signal.removeAll where it could try to shorten the _bindings even if undefined. -* Added the new FXManager which is used for handling all special effects on Cameras (and soon other game objects). -* Removed Flash, Fade and Shake from the Camera class and moved to the new SpecialFX project. -* SpecialFX compiles to phaser-fx.js in the build folder, which is copied over to Tests. If you don't need the FX, don't include the .js file. -* The project is now generating TypeScript declaration files and all Tests were updated to use them in their references. -* Fixed a bug in Flash, Fade and Shake where the duration would fail on anything above 3 seconds. -* Fixed a bug in Camera Shake that made it go a bit haywire, now shakes correctly. -* Added new Scanlines Camera FX. -* Fixed offset values being ignored in GeomSprite.renderPoint (thanks bapuna). -* Added new Mirror Camera FX. Can mirror the camera image horizontally, vertically or both with an optional fill color overlay. -* Added Camera.disableClipping for when you don't care about things being drawn outside the edge (useful for some FX). -* Updated TilemapLayer so that collision data is now stored in _tempTileBlock to avoid constant array creation during game loop. -* TilemapLayer.getTileOverlaps() now returns all tiles the object overlapped with rather than just a boolean. -* Tilemap.collide now optionally takes callback and context parameters which are used if collision occurs. -* Added Tilemap.collisionCallback and Tilemap.collisionCallbackContext so you can set them once and not re-set them on every call to collide. -* Collision.separateTile now has 2 extra parameters: separateX and separateY. If true the object will be separated on overlap, otherwise just the overlap boolean result is returned. -* Added Tile.separateX and Tile.separateY (both true by default). Set to false if you don't want a tile to stop an object from moving, you just want it to return collision data to your callback. -* Added Tilemap.getTileByIndex(value) to access a specific type of tile, rather than by its map index. -* Added TilemapLayer.putTile(x,y,index) - allows you to insert new tile data into the map layer (create your own tile editor!). -* TilemapLayer.getTileBlock now returns a unique Array of map data, not just a reference to the temporary block array -* Added TilemapLayer.swapTile - scans the given region of the map for all instances of tileA and swaps them for tileB, and vice versa. -* Added TilemapLayer.replaceTile - scans the given region of the map and replaces all instances of tileA with tileB. tileB is left unaffected. -* Added TilemapLayer.fillTiles - fills the given region of the map with the tile specified. -* Added TilemapLayer.randomiseTiles - fills the given region of the map with a random tile from the list specified. -* Added fun new "map draw" test - rebound those carrots! :) -* Changed SoundManager class to respect volume on first play (thanks initials and hackmaniac) - -V0.9.4 - -* Added Tilemap.getTile, getTileFromWorldXY, getTileFromInputXY -* Added Tilemap.setCollisionByIndex and setCollisionByRange -* Added GameObject.renderRotation boolean to control if the sprite will visually rotate or not (useful when angle needs to change but graphics don't) -* Added additional check to Camera.width/height so you cannot set them larger than the Stage size -* Added Collision.separateTile and Tilemap.collide -* Fixed Tilemap bounds check if map was smaller than game dimensions -* Fixed: Made World._cameras public, World.cameras and turned Game.camera into a getter for it (thanks Hackmaniac) -* Fixed: Circle.isEmpty properly checks diameter (thanks bapuna) -* Updated Gruntfile to export new version of phaser.js wrapped in a UMD block for require.js/commonJS (thanks Hackmaniac) - -V0.9.3 - -* Added the new ScrollZone game object. Endlessly useful but especially for scrolling backdrops. Created 6 example tests. -* Added GameObject.hideFromCamera(cameraID) to stop an object rendering to specific cameras (also showToCamera and clearCameraList) -* Added GameObject.setBounds() to confine a game object to a specific area within the world (useful for stopping them going off the edges) -* Added GameObject.outOfBoundsAction, can be either OUT OF BOUNDS STOP which stops the object moving, or OUT OF BOUNDS KILL which kills it. -* Added GameObject.rotationOffset. Useful if your graphics need to rotate but weren't drawn facing zero degrees (to the right). -* Added shiftSinTable and shiftCosTable to the GameMath class to allow for quick iteration through the data tables. -* Added more robust frame checking into AnimationManager -* Re-built Tilemap handling from scratch to allow for proper layered maps (as exported from Tiled / Mappy) -* Tilemap no longer requires a buffer per Camera (in prep for WebGL support) -* Fixed issues with Group not adding reference to Game to newly created objects (thanks JesseFreeman) -* Fixed a potential race condition issue in Game.boot (thanks Hackmaniac) -* Fixed issue with showing frame zero of a texture atlas before the animation started playing (thanks JesseFreeman) -* Fixed a bug where Camera.visible = false would still render -* Removed the need for DynamicTextures to require a key property and updated test cases. -* You can now pass an array or a single value to Input.Keyboard.addKeyCapture(). - -V0.9.2 - -* Fixed issue with create not being called if there was an empty init method. -* Added ability to flip a sprite (Sprite.flipped = true) + a test case for it. -* Added ability to restart a sprite animation. -* Sprite animations don't restart if you call play on them when they are already running. -* Added Stage.disablePauseScreen. Set to true to stop your game pausing when the tab loses focus. - -V0.9.1 - -* Added the new align property to GameObjects that controls placement when rendering. -* Added an align example to the Sprites test group (click the mouse to change alignment position) -* Added a new MicroPoint class. Same as Point but much smaller / less functions, updated GameObject to use it. -* Completely rebuilt the Rectangle class to use MicroPoints and store the values of the 9 points around the edges, to be used -for new collision system. -* Game.Input now has 2 signals you can subscribe to for down/up events, see the Sprite align example for use. -* Updated the States examples to bring in-line with 0.9 release. - -V0.9 - -* Large refactoring. Everything now lives inside the Phaser module, so all code and all tests have been updated to reflect this. Makes coding a tiny bit more verbose but stops the framework from globbing up the global namespace. Also should make code-insight work in WebStorm and similar editors. -* Added the new GeomSprite object. This is a sprite that uses a geometry class for display (Circle, Rectangle, Point, Line). It's extremely flexible! -* Added Geometry intersection results objects. -* Added new Collision class and moved some functions there. Contains all the Game Object and Geometry Intersection methods. -* Can now create a sprite animation based on frame names rather than indexes. Useful when you've an animation inside a texture atlas. Added test to show. -* Added addKeyCapture(), removeKeyCapture() and clearCaptures() to Input.Keyboard. Calls event.preventDefault() on any keycode set to capture, allowing you to avoid page scrolling when using the cursor keys in a game for example. -* Added new Motion class which contains lots of handy functions like 'moveTowardsObject', 'velocityFromAngle' and more. -* Tween Manager added. You can now create tweens via Game.createTween (or for more control game.tweens). All the usual suspects are here: Bounce, * Elastic, Quintic, etc and it's hooked into the core game clock, so if your game pauses and resumes your tweens adjust accordingly. - -V0.8 - -* Added ability to set Sprite frame by name (sprite.frameName), useful when you've loaded a Texture Atlas with filename values set rather than using frame indexes. -* Updated texture atlas 4 demo to show this. -* Fixed a bug that would cause a run-time error if you tried to create a sprite using an invalid texture key. -* Added in DynamicTexture support and a test case for it. - -V0.7 - -* Renamed FullScreen to StageScaleMode as it's much more fitting. Tested across Android and iOS with the various scale modes. -* Added in world x/y coordinates to the input class, and the ability to get world x/y input coordinates from any Camera. -* Added the RandomDataGenerator for seeded random number generation. -* Setting the game world size now resizes the default camera (optional bool flag) - -V0.6 - -* Added in Touch support for mobile devices (and desktops that enable it) and populated x/y coords in Input with common values from touch and mouse. -* Added new Circle geometry class (used by Touch) and moved them into a Geom folder. -* Added in Device class for device inspection. -* Added FullScreen class to enable full-screen support on mobile devices (scrolls URL bar out of the way on iOS and Android) - -V0.5 - -* Initial release -  License diff --git a/changelog.md b/changelog.md new file mode 100644 index 00000000..e8e555a7 --- /dev/null +++ b/changelog.md @@ -0,0 +1,316 @@ +Change Log +---------- + +V0.9.8 + +* Massive refactoring across the entire codebase. +* Removed Basic and GameObject and put Sprite on a diet. 127 properties and methods cut down to 32. +* Added a new headless renderer for non-display related performance testing. +* Added camera type to the CameraManager for future non-orthographic cameras. +* Added Camera.destroy - now clears down the FX and unregisters itself from the CameraManager. +* Added Camera.hide/show to hide Sprites or Groups from rendering (and removed corresponding hideFromCamera methods from Sprites/Groups) +* Heavily optimised Group so it no longer creates any temporary variables in any methods. +* Added Game.renderer which can be HEADLESS, CANVAS or WEBGL (coming soon) +* Added Sprite.render which is a reference to IRenderer.renderSprite, but can be overridden for custom handling. +* Refactored QuadTree so it no longer creates any temporary variables in any methods. +* The Sprite Renderer now uses a single setTransform for scale, rotation and translation that respects the Sprite.origin value in all cases. +* Sprite.modified is set to true if scale, rotation, skew or flip have been used. +* Added Tween.loop property so they can now re-run themselves indefinitely. +* Added Tween.yoyo property so they can reverse themselves after completing. +* Added Gravity to the Physics component. +* Removed Sprite.angle - use Sprite.rotation instead +* Optimised separateX/Y and overlap so they don't use any temporary vars any more. +* Added the new Physics.Body object to all Sprites. Used for all physics calculations in-game. Will be extended for Fixtures/Joints in future. +* Added SpriteUtils.setOriginToCenter to quickly set the origin of a sprite based on either frameBounds or body.bounds +* Added Sprite.Input component for tracking Input events over a Sprite +* Added Sprite.Input.useHandCursor (for desktop) +* Added Sprite.Input.justOver and justOut with a configurable ms delay +* Added Sprite.Events component for a global easy to access area to listen to events from +* Added Group.ID, each Group has a unique ID. Added Sprite.group (and Group.group) which is a reference to the Group it was added to. +* Added Group.addNewSprite(x,y,key) for quick addition of new Sprites to a Group +* Fixed Group.sort so the sortHandler is called correctly +* Added Group.swap(a,b) to swap the z-index of 2 objects with optional rendering update boolean +* Sprites dispatch new events for: killed, revived, added to Group and removed from Group. +* Added Input drag, bounds, sprite bounds and snapping support. +* Added the new ColorUtils class full of lots of handy color manipulation functions. +* Fixed issue in Camera.inCamera check where it wouldn't take into consideration the Sprites scrollFactor. +* Fixed issue with JSON Atlas loader incorrectly parsing the frames array. +* Fixed bug in FrameData.getFrameByName where the first frame of the array would always be skipped. +* Fixed bug where the Stage.backgroundColor property wasn't being saved correctly. +* Made Stage.bootScreen and Stage.pauseScreen public so you can override them with your own States now. +* Added the new OrientationScreen and Stage.enableOrientationCheck to allow for easy 'portrait/landscape only' game handling. +* Added fix to StageScaleMode for 180 degree portrait orientation on iPad. +* Added fix to orientation check so that it updates the input offsets correctly on rotation. +* Added support for minWidth and minHeight to game scale size, so it can never go below those values when scaling. +* Vastly improved orientation detection and response speed. +* Added custom callback support for all Touch and Mouse Events so you can easily hook events to custom APIs. +* Updated Game.loader and its methods. You now load images by: game.load.image() and also: game.load.atlas, game.load.audio, game.load.spritesheet, game.load.text. And you start it with game.load.start(). +* Added optional frame parameter to Phaser.Sprite (and game.add.sprite) so you can set a frame ID or frame name on construction. +* Fixed bug where passing a texture atlas string would incorrectly skip the frames array. +* Added AnimationManager.autoUpdateBounds to control if a new frame should change the physics bounds of a sprite body or not. +* Added StageScaleMode.pageAlignHorizontally and pageAlignVertically booleans. When true Phaser will set the margin-left and top of the canvas element so that it is positioned in the middle of the page (based only on window.innerWidth). +* Added support for globalCompositeOperation, opaque and backgroundColor to the Sprite.Texture and Camera.Texture components. +* Added ability for a Camera to skew and rotate around an origin. +* Moved the Camera rendering into CanvasRenderer to keep things consistent. +* Added Stage.setImageRenderingCrisp to quickly set the canvas image-rendering to crisp-edges (note: poor browser support atm) +* Sprite.width / height now report the scaled width height, setting them adjusts the scale as it does so. +* Created a Transform component containing scale, skew, rotation, scrollFactor, origin and rotationOffset. Added to Sprite, Camera, Group. +* Created a Texture component containing image data, alpha, flippedX, flippedY, etc. Added to Sprite, Camera, Group. +* Added CameraManager.swap and CameraManager.sort methods and added a z-index property to Camera to control render order. +* Added World.postUpdate loop + Group and Camera postUpdate methods. +* Fixed issue stopping Pointer from working in world coordinates and fixed the world drag example. +* For consistency renamed input.scaledX/Y to input.scale. +* Added input.activePointer which contains a reference to the most recently active pointer. +* Sprite.Transform now has upperLeft, upperRight, bottomLeft and bottomRight Point properties and lots of useful coordinate related methods. +* Camera.inCamera check now uses the Sprite.worldView which finally accurately updates regardless of scale, rotation or rotation origin. +* Added Math.Mat3 for Matrix3 operations (which Sprite.Transform uses) and Math.Mat3Utils for lots of use Mat3 related methods. +* Added SpriteUtils.overlapsXY and overlapsPoint to check if a point is within a sprite, taking scale and rotation into account. +* Added Cache.getImageKeys (and similar) to return an array of all the keys for all currently cached objects. +* Added Group.bringToTop feature. Will sort the Group, move the given sprites z-index to the top and shift the rest down by one. +* Brand new Advanced Physics system added and working! Woohoo :) +* Fixed issue in Tilemap.parseTiledJSON where it would accidentally think image and object layers were map data. +* Fixed bug in Group.bringToTop if the child didn't have a group property yet. +* Fixed bug in FrameData.checkFrameName where the first index of the _frameNames array would be skipped. +* Added isRunning boolean property to Phaser.Tween +* Moved 'facing' property from Sprite.body to Sprite.texture (may move to Sprite core) +* Added Sprite.events.onDragStart and onDragStop +* A tilemap can now be loaded without a tile sheet, should you just want to get the tile data from it and not render. +* Added new Sprite.events: onAnimationStart, onAnimationComplete, onAnimationLoop +* Added in support for the Input component PriorityID value and refactored Input.Pointer to respect it. Rollovers are perfect now :) +* Added 2 new State functions: loadRender and loadUpdate, are called the same as render and update but only during the load process +* Fixed Input.stopDrag so it fires an onInputUp event as well from the sprite. +* Added support for a preRender state - very useful for certain types of special effects. +* Cameras are now limited so they can never be larger than the Game.Stage size. +* Added a new Button Game Object for easily creating in-game UI and menu systems. +* Fixed bug where Sprite.alpha wasn't properly reflecting Sprite.texture.alpha. +* Fixed bug where the hand cursor would be reset on input up, even if the mouse was still over the sprite. +* Fixed bug where pressing down then moving out of the sprite area wouldn't properly reset the input state next time you moved over the sprite. +* Added the Sprite.tween property, really useful to avoid creating new tween vars in your local scope if you don't need them. +* Added support for pagehide and pageshow events to Stage, hooked in to the pause/resume game methods. +* Extended Device audio checks to include opus and webm. +* Updated Loader and Cache so they now support loading of Audio() tags as well as Web Audio. +* Set Input.recordPointerHistory to false, you now need to enable the pointer tracking if you wish to use it. +* SoundManager will now automatically handle iOS touch unlocking. +* Added TilemapLayer.putTileWorldXY to place a tile based on pixel values, and putTile based on tile map coordinates. +* Dropped the StageScaleMode.setScreenSize iterations count from 40 down to 10 and document min body height to 2000px. +* Added Phaser.Net for browser and network specific functions, currently includes query string parsing and updating methods. +* Added a new CSS3 Filters component. Apply blur, grayscale, sepia, brightness, contrast, hue rotation, invert, opacity and saturate filters to the games stage. +* Fixed the CircleUtils.contains and containsPoint methods. +* Fixed issue with Input.speed values being too high on new touch events. +* Added Sprite.bringToTop() +* Added Stage.disableVisibilityChange to stop the auto pause/resume from ever firing. +* Added crop support to the Texture component, so you can do Sprite.crop to restrict rendering to a specified Rectangle without distortion. +* Added references to all the event listener functions so they can be cleanly destroyed. +* Fixed interesting Firefox issue when an audio track ended it fired another 'canplaythrough' event, confusing the Loader. +* Added the new PluginManager. Moved all the Camera FX over to plugins. Everything will be a plugin from now on. +* Added Sprite.transform.centerOn(x,y) to quickly center a sprite on a coordinate without messing with the sprite origin and regardless of rotation. +* Added Input.pollRate - this lets you limit how often Pointer events are handled (0 = every frame, 1 = every other frame, etc) +* Renamed the 'init' function to 'preload'. It now calls load.start automatically. +* Added CanvasUtils class, including ability to set image rendering, add a canvas to the dom and other handy things. + + +V0.9.6 + +* Virtually every class now has documentation - if you spot a typo or something missing please shout (thanks pixelpicosean). +* Grunt file updated to produce the new Special FX JS file (thanks HackManiac). +* Fixed issue stopping Phaser working on iOS 5 (iPad 1). +* Created new mobile test folder, updated index.php to use mobile CSS and made some mobile specific tests. +* Fixed a few speed issues on Android 2.x stock browser. +* Moved Camera context save/restore back inside parameter checks (sped-up Samsung S3 stock browser). +* Fixed bug with StageScaleMode.checkOrientation not respecting the NO_SCALE value. +* Added MSPointer support (thanks Diego Bezerra). +* Added Camera.clear to perform a clearRect instead of a fillRect if needed (default is false). +* Swapped Camera.opaque default from true to false re: performance. +* Updated Stage.visibilityChange to avoid pause screen locking in certain situations. +* Added StageScaleMode.enterLandscape and enterPortrait signals for easier device orientation change checks. +* Added StageScaleMode.isPortrait. +* Updated StageScaleMode to check both window.orientationchange and window.resize events. +* Updated RequestAnimationFrame to use performance.now for sub-millisecond precision and to drive the Game.time.update loop. +* Updated RequestAnimationFrame setTimeout to use fixed timestep and re-ordered callback sequence. Android 2/iOS5 performance much better now. +* Removed Stage.ORIENTATION_LANDSCAPE statics because the values should be taken from Stage.scale.isPortrait / isLandscape. +* Removed Stage.maxScaleX/Y and moved them into StageScaleMode.minWidth, minHeight, maxWidth and maxHeight. +* Fixed Stage.scale so that it resizes without needing an orientation change first. +* Added StageScaleMode.startFullscreen(), stopFullScreen() and isFullScreen for making use of the FullScreen API on desktop browsers. +* Swapped Stage.offset from Point to MicroPoint. +* Swapped Stage.bounds from Rectangle to Quad. +* Added State.destroy support. A states destroy function is called when you switch to a new state (thanks JesseFreeman). +* Added Sprite.fillColor, used in the Sprite render if no image is loaded (set via the property or Sprite.makeGraphic) (thanks JesseFreeman). +* Renamed Phaser.Finger to Phaser.Pointer. +* Updated all of the Input classes so they now use Input.pointers 1 through 10. +* Updated Touch and MSPointer to allow multi-touch support (when the hardware supports it) and created new tests to show this. +* Added Input.getPointer, Input.getPointerFromIdentifier, Input.totalActivePointers and Input.totalInactivePointers. +* Added Input.startPointer, Input.updatePointer and Input.stopPointer. +* Phaser Input now confirmed working on Windows Phone 8 (Nokia Lumia 920). +* Added Input.maxPointers to allow you to limit the number of fingers your game will listen for on multi-touch systems. +* Added Input.addPointer. By default Input will create 5 pointers (+1 for the mouse). Use addPointer() to add up to a maximum of 10. +* Added Input.position - a Vector2 object containing the most recent position of the most recently active Pointer. +* Added Input.getDistance. Find the distance between the two given Pointer objects. +* Added Input.getAngle. Find the angle between the two given Pointer objects. +* Pointer.totalTouches value keeps a running total of the number of times the Pointer has been pressed. +* Added Pointer.position and positionDown. positionDown is placed on touch and position is update on move, useful for tracking distance/direction/gestures. +* Added Game.state - now contains a reference to the current state object (if any was given). +* Moved the Input start events from the constructors to a single Input.start method. +* Added Input.disabled boolean to globally turn off all input event processing. +* Added Input.Mouse.disabled, Input.Touch.disabled, Input.MSPointer.disabled and Input.Keyboard.disabled. +* Added Device.mspointer boolean. true if MSPointer is available on the device. +* Added Input.onDown, onUp, onTap, onDoubleTap and onHold signals - all fired by the mouse or touch. +* Added Input.recordPointerHistory to record the x/y coordinates a Pointer tracks through. Also Input.recordRate and Input.recordLimit for fine control. +* Added Input.multiInputOverride which can be MOUSE_OVERRIDES_TOUCH, TOUCH_OVERRIDES_MOUSE or MOUSE_TOUCH_COMBINE. +* Added GameObject.setBoundsFromWorld to quickly set the bounds of a game object to match those of the current game world. +* Added GameObject.canvas and GameObject.context. By default they reference Stage.canvas but can be changed to anything, i.e. a DynamicTexture +* The new canvas and context references are applied to Sprite, GeomSprite and TilemapLayer +* Added DynamicTexture.assignCanvasToGameObjects() to allow you to redirect GameObject rendering en-mass to a DynamicTexture +* Added DynamicTexture.render(x,y) to render the texture to the Stage canvas +* Added Basic.ignoreGlobalUpdate - stops the object being updated as part of the main game loop, you'll need to call update on it yourself +* Added Basic.ignoreGlobalRender - stops the object being rendered as part of the main game loop, you'll need to call render on it yourself +* Added forceUpdate and forceRender parameters to Group.update and Group.render respectively. Combined with ignoreGlobal you can create custom rendering set-ups +* Fixed Loader.progress calculation so it now accurately passes a value between 0 and 100 to your loader callback +* Added a 'hard reset' parameter to Input.reset. A hard reset clears Input signals (such as on a state swap), a soft (such as on game pause) doesn't +* Added Device.isConsoleOpen() to check if the browser console is open. Tested on Firefox with Firebug and Chrome with DevTools +* Added delay parameter to Tween.to() +* Fixed bug where GeomSprite.renderOutline was being ignored for Circle objects +* Fixed bug with GeomSprite circles rendering at twice the size they should have been and offset from actual x/y values +* Added Sprite.cacheKey which stores the key of the item from the cache that was used for its texture (if any) +* Added GameMath.shuffleArray +* Updated Animation.frame to return the index of the currentFrame if set +* Added Quad.copyTo and Quad.copyFrom +* Removed the bakedRotations parameter from Emiter.makeParticles - update your code accordingly! +* Updated various classes to remove the Flixel left-over CamelCase parameters +* Updated QuadTree to use the new CollisionMask values and significantly optimised and reduced overall class size +* Updated Collision.seperate to use the new CollisionMask +* Added a callback context parameter to Game.collide, Collision.overlap and the QuadTree class +* Stage.canvas now calls preventDefault() when the context menu is activated (oncontextmenu) +* Added Point.rotate to allow you to rotate a point around another point, with optional distance clamping. Also created test cases. +* Added Group.alpha to apply a globalAlpha before the groups children are rendered. Useful to save on alpha calls. +* Added Group.globalCompositeOperation to apply a composite operation before all of the groups children are rendered. +* Added Camera black list support to Sprite and Group along with Camera.show, Camera.hide and Camera.isHidden methods to populate them. +* Added GameMath.rotatePoint to allow for point rotation at any angle around a given anchor and distance +* Updated World.setSize() to optionally update the VerletManager dimensions as well +* Added GameObject.setPosition(x, y) +* Added Quad.intersectsRaw(left, right, top, bottom, tolerance) +* Updated Sprite.inCamera to correctly apply the scrollFactor to the camera bounds check +* Added Loader.crossOrigin property which is applied to loaded Images +* Added AnimationManager.destroy() to clear out all local references and objects +* Added the clearAnimations parameter to Sprite.loadGraphic(). Allows you to change animation textures but retain the frame data. +* Added the GameObjectFactory to Game. You now make Sprites like this: game.add.sprite(). Much better separation of game object creation methods now. But you'll have to update ALL code, sorry! (blame JesseFreeman for breaking your code and coming up with the idea :) +* Added GameObjectFactory methods to add existing objects to the game world, such as existingSprite(), existingTween(), etc. +* Added the GameObjectFactory to Phaser.State +* Added new format parameter to Loader.addTextureAtlas defining the format. Currently supported: JSON Array and Starling/Sparrow XML. + +V0.9.5 + +* Moved the BootScreen and PauseScreen out of Stage into their own classes (system/screens/BootScreen and PauseScreen). +* Updated the PauseScreen to show a subtle animation effect, making it easier to create your own interesting pause screens. +* Modified Game so it splits into 3 loops - bootLoop, pauseLoop and loop (the core loop). +* Updated the BootScreen with the new logo and new color cycle effect. +* Added Game.isRunning - set to true once the Game.boot process is over IF you gave some functions to the constructor or a state. +* Fixed small bug in Signal.removeAll where it could try to shorten the _bindings even if undefined. +* Added the new FXManager which is used for handling all special effects on Cameras (and soon other game objects). +* Removed Flash, Fade and Shake from the Camera class and moved to the new SpecialFX project. +* SpecialFX compiles to phaser-fx.js in the build folder, which is copied over to Tests. If you don't need the FX, don't include the .js file. +* The project is now generating TypeScript declaration files and all Tests were updated to use them in their references. +* Fixed a bug in Flash, Fade and Shake where the duration would fail on anything above 3 seconds. +* Fixed a bug in Camera Shake that made it go a bit haywire, now shakes correctly. +* Added new Scanlines Camera FX. +* Fixed offset values being ignored in GeomSprite.renderPoint (thanks bapuna). +* Added new Mirror Camera FX. Can mirror the camera image horizontally, vertically or both with an optional fill color overlay. +* Added Camera.disableClipping for when you don't care about things being drawn outside the edge (useful for some FX). +* Updated TilemapLayer so that collision data is now stored in _tempTileBlock to avoid constant array creation during game loop. +* TilemapLayer.getTileOverlaps() now returns all tiles the object overlapped with rather than just a boolean. +* Tilemap.collide now optionally takes callback and context parameters which are used if collision occurs. +* Added Tilemap.collisionCallback and Tilemap.collisionCallbackContext so you can set them once and not re-set them on every call to collide. +* Collision.separateTile now has 2 extra parameters: separateX and separateY. If true the object will be separated on overlap, otherwise just the overlap boolean result is returned. +* Added Tile.separateX and Tile.separateY (both true by default). Set to false if you don't want a tile to stop an object from moving, you just want it to return collision data to your callback. +* Added Tilemap.getTileByIndex(value) to access a specific type of tile, rather than by its map index. +* Added TilemapLayer.putTile(x,y,index) - allows you to insert new tile data into the map layer (create your own tile editor!). +* TilemapLayer.getTileBlock now returns a unique Array of map data, not just a reference to the temporary block array +* Added TilemapLayer.swapTile - scans the given region of the map for all instances of tileA and swaps them for tileB, and vice versa. +* Added TilemapLayer.replaceTile - scans the given region of the map and replaces all instances of tileA with tileB. tileB is left unaffected. +* Added TilemapLayer.fillTiles - fills the given region of the map with the tile specified. +* Added TilemapLayer.randomiseTiles - fills the given region of the map with a random tile from the list specified. +* Added fun new "map draw" test - rebound those carrots! :) +* Changed SoundManager class to respect volume on first play (thanks initials and hackmaniac) + +V0.9.4 + +* Added Tilemap.getTile, getTileFromWorldXY, getTileFromInputXY +* Added Tilemap.setCollisionByIndex and setCollisionByRange +* Added GameObject.renderRotation boolean to control if the sprite will visually rotate or not (useful when angle needs to change but graphics don't) +* Added additional check to Camera.width/height so you cannot set them larger than the Stage size +* Added Collision.separateTile and Tilemap.collide +* Fixed Tilemap bounds check if map was smaller than game dimensions +* Fixed: Made World._cameras public, World.cameras and turned Game.camera into a getter for it (thanks Hackmaniac) +* Fixed: Circle.isEmpty properly checks diameter (thanks bapuna) +* Updated Gruntfile to export new version of phaser.js wrapped in a UMD block for require.js/commonJS (thanks Hackmaniac) + +V0.9.3 + +* Added the new ScrollZone game object. Endlessly useful but especially for scrolling backdrops. Created 6 example tests. +* Added GameObject.hideFromCamera(cameraID) to stop an object rendering to specific cameras (also showToCamera and clearCameraList) +* Added GameObject.setBounds() to confine a game object to a specific area within the world (useful for stopping them going off the edges) +* Added GameObject.outOfBoundsAction, can be either OUT OF BOUNDS STOP which stops the object moving, or OUT OF BOUNDS KILL which kills it. +* Added GameObject.rotationOffset. Useful if your graphics need to rotate but weren't drawn facing zero degrees (to the right). +* Added shiftSinTable and shiftCosTable to the GameMath class to allow for quick iteration through the data tables. +* Added more robust frame checking into AnimationManager +* Re-built Tilemap handling from scratch to allow for proper layered maps (as exported from Tiled / Mappy) +* Tilemap no longer requires a buffer per Camera (in prep for WebGL support) +* Fixed issues with Group not adding reference to Game to newly created objects (thanks JesseFreeman) +* Fixed a potential race condition issue in Game.boot (thanks Hackmaniac) +* Fixed issue with showing frame zero of a texture atlas before the animation started playing (thanks JesseFreeman) +* Fixed a bug where Camera.visible = false would still render +* Removed the need for DynamicTextures to require a key property and updated test cases. +* You can now pass an array or a single value to Input.Keyboard.addKeyCapture(). + +V0.9.2 + +* Fixed issue with create not being called if there was an empty init method. +* Added ability to flip a sprite (Sprite.flipped = true) + a test case for it. +* Added ability to restart a sprite animation. +* Sprite animations don't restart if you call play on them when they are already running. +* Added Stage.disablePauseScreen. Set to true to stop your game pausing when the tab loses focus. + +V0.9.1 + +* Added the new align property to GameObjects that controls placement when rendering. +* Added an align example to the Sprites test group (click the mouse to change alignment position) +* Added a new MicroPoint class. Same as Point but much smaller / less functions, updated GameObject to use it. +* Completely rebuilt the Rectangle class to use MicroPoints and store the values of the 9 points around the edges, to be used +for new collision system. +* Game.Input now has 2 signals you can subscribe to for down/up events, see the Sprite align example for use. +* Updated the States examples to bring in-line with 0.9 release. + +V0.9 + +* Large refactoring. Everything now lives inside the Phaser module, so all code and all tests have been updated to reflect this. Makes coding a tiny bit more verbose but stops the framework from globbing up the global namespace. Also should make code-insight work in WebStorm and similar editors. +* Added the new GeomSprite object. This is a sprite that uses a geometry class for display (Circle, Rectangle, Point, Line). It's extremely flexible! +* Added Geometry intersection results objects. +* Added new Collision class and moved some functions there. Contains all the Game Object and Geometry Intersection methods. +* Can now create a sprite animation based on frame names rather than indexes. Useful when you've an animation inside a texture atlas. Added test to show. +* Added addKeyCapture(), removeKeyCapture() and clearCaptures() to Input.Keyboard. Calls event.preventDefault() on any keycode set to capture, allowing you to avoid page scrolling when using the cursor keys in a game for example. +* Added new Motion class which contains lots of handy functions like 'moveTowardsObject', 'velocityFromAngle' and more. +* Tween Manager added. You can now create tweens via Game.createTween (or for more control game.tweens). All the usual suspects are here: Bounce, * Elastic, Quintic, etc and it's hooked into the core game clock, so if your game pauses and resumes your tweens adjust accordingly. + +V0.8 + +* Added ability to set Sprite frame by name (sprite.frameName), useful when you've loaded a Texture Atlas with filename values set rather than using frame indexes. +* Updated texture atlas 4 demo to show this. +* Fixed a bug that would cause a run-time error if you tried to create a sprite using an invalid texture key. +* Added in DynamicTexture support and a test case for it. + +V0.7 + +* Renamed FullScreen to StageScaleMode as it's much more fitting. Tested across Android and iOS with the various scale modes. +* Added in world x/y coordinates to the input class, and the ability to get world x/y input coordinates from any Camera. +* Added the RandomDataGenerator for seeded random number generation. +* Setting the game world size now resizes the default camera (optional bool flag) + +V0.6 + +* Added in Touch support for mobile devices (and desktops that enable it) and populated x/y coords in Input with common values from touch and mouse. +* Added new Circle geometry class (used by Touch) and moved them into a Geom folder. +* Added in Device class for device inspection. +* Added FullScreen class to enable full-screen support on mobile devices (scrolls URL bar out of the way on iOS and Android) + +V0.5 + +* Initial release diff --git a/src/animation/Parser.js b/src/animation/Parser.js index 11fc0c1c..38b1a4d6 100644 --- a/src/animation/Parser.js +++ b/src/animation/Parser.js @@ -113,10 +113,10 @@ Phaser.Animation.Parser = { )); PIXI.TextureCache[uuid] = new PIXI.Texture(PIXI.BaseTextureCache[cacheKey], { - x: frames[key].frame.x, - y: frames[key].frame.y, - width: frames[key].frame.w, - height: frames[key].frame.h + x: frames[i].frame.x, + y: frames[i].frame.y, + width: frames[i].frame.w, + height: frames[i].frame.h }); if (frames[i].trimmed) @@ -131,7 +131,7 @@ Phaser.Animation.Parser = { frames[i].spriteSourceSize.h ); - PIXI.TextureCache[uuid].realSize = frames[key].spriteSourceSize; + PIXI.TextureCache[uuid].realSize = frames[i].spriteSourceSize; PIXI.TextureCache[uuid].trim.x = 0; } } diff --git a/todo/ArcadeEmitter.ts b/todo/ArcadeEmitter.ts deleted file mode 100644 index 95ea1d24..00000000 --- a/todo/ArcadeEmitter.ts +++ /dev/null @@ -1,465 +0,0 @@ -///-/// -/// -/// - -/** -* Phaser - ArcadeEmitter -* -* Emitter is a lightweight particle emitter. It can be used for one-time explosions or for -* continuous effects like rain and fire. All it really does is launch Particle objects out -* at set intervals, and fixes their positions and velocities accorindgly. -*/ - -module Phaser { - - export class ArcadeEmitter extends Group { - - /** - * Creates a new Emitterobject at a specific position. - * Does NOT automatically generate or attach particles! - * - * @param x {number} The X position of the emitter. - * @param y {number} The Y position of the emitter. - * @param [size] {number} Specifies a maximum capacity for this emitter. - */ - constructor(game: Game, x: number = 0, y: number = 0, size: number = 0) { - - super(game, size); - - this.x = x; - this.y = y; - this.width = 0; - this.height = 0; - this.minParticleSpeed = new Vec2(-100, -100); - this.maxParticleSpeed = new Vec2(100, 100); - this.minRotation = -360; - this.maxRotation = 360; - this.gravity = 0; - this.particleClass = null; - this.particleDrag = new Vec2(); - this.frequency = 0.1; - this.lifespan = 3; - this.bounce = 0; - this._quantity = 0; - this._counter = 0; - this._explode = true; - this.on = false; - - this.exists = true; - this.active = true; - this.visible = true; - - } - - /** - * The X position of the top left corner of the emitter in world space. - */ - public x: number; - - /** - * The Y position of the top left corner of emitter in world space. - */ - public y: number; - - /** - * The width of the emitter. Particles can be randomly generated from anywhere within this box. - */ - public width: number; - - /** - * The height of the emitter. Particles can be randomly generated from anywhere within this box. - */ - public height: number; - - /** - * - */ - public alive: boolean; - - /** - * - */ - public active: boolean; - - /** - * The minimum possible velocity of a particle. - * The default value is (-100,-100). - */ - public minParticleSpeed: Vec2; - - /** - * The maximum possible velocity of a particle. - * The default value is (100,100). - */ - public maxParticleSpeed: Vec2; - - /** - * The X and Y drag component of particles launched from the emitter. - */ - public particleDrag: Vec2; - - /** - * The minimum possible angular velocity of a particle. The default value is -360. - * NOTE: rotating particles are more expensive to draw than non-rotating ones! - */ - public minRotation: number; - - /** - * The maximum possible angular velocity of a particle. The default value is 360. - * NOTE: rotating particles are more expensive to draw than non-rotating ones! - */ - public maxRotation: number; - - /** - * Sets theacceleration.ymember of each particle to this value on launch. - */ - public gravity: number; - - /** - * Determines whether the emitter is currently emitting particles. - * It is totally safe to directly toggle this. - */ - public on: boolean; - - /** - * How often a particle is emitted (if emitter is started with Explode == false). - */ - public frequency: number; - - /** - * How long each particle lives once it is emitted. - * Set lifespan to 'zero' for particles to live forever. - */ - public lifespan: number; - - /** - * How much each particle should bounce. 1 = full bounce, 0 = no bounce. - */ - public bounce: number; - - /** - * Set your own particle class type here. - * Default isParticle. - */ - public particleClass; - - /** - * Internal helper for deciding how many particles to launch. - */ - private _quantity: number; - - /** - * Internal helper for the style of particle emission (all at once, or one at a time). - */ - private _explode: boolean; - - /** - * Internal helper for deciding when to launch particles or kill them. - */ - private _timer: number; - - /** - * Internal counter for figuring out how many particles to launch. - */ - private _counter: number; - - /** - * Internal point object, handy for reusing for memory mgmt purposes. - */ - private _point: Vec2; - - /** - * Clean up memory. - */ - public destroy() { - this.minParticleSpeed = null; - this.maxParticleSpeed = null; - this.particleDrag = null; - this.particleClass = null; - this._point = null; - super.destroy(); - } - - /** - * This function generates a new array of particle sprites to attach to the emitter. - * - * @param graphics If you opted to not pre-configure an array of Sprite objects, you can simply pass in a particle image or sprite sheet. - * @param quantity {number} The number of particles to generate when using the "create from image" option. - * @param multiple {boolean} Whether the image in the Graphics param is a single particle or a bunch of particles (if it's a bunch, they need to be square!). - * @param collide {number} Whether the particles should be flagged as not 'dead' (non-colliding particles are higher performance). 0 means no collisions, 0-1 controls scale of particle's bounding box. - * - * @return This Emitter instance (nice for chaining stuff together, if you're into that). - */ - public makeParticles(graphics, quantity: number = 50, multiple: boolean = false, collide: number = 0): ArcadeEmitter { - - this.maxSize = quantity; - - var totalFrames: number = 1; - - /* - if(Multiple) - { - var sprite:Sprite = new Sprite(this.game); - sprite.loadGraphic(Graphics,true); - totalFrames = sprite.frames; - sprite.destroy(); - } - */ - - var randomFrame: number; - var particle: ArcadeParticle; - var i: number = 0; - - while (i < quantity) - { - if (this.particleClass == null) - { - particle = new ArcadeParticle(this.game); - } - else - { - particle = new this.particleClass(this.game); - } - - if (multiple) - { - /* - randomFrame = this.game.math.random()*totalFrames; - */ - } - else - { - if (graphics) - { - particle.texture.loadImage(graphics); - } - } - - if (collide > 0) - { - //particle.body.allowCollisions = Types.ANY; - particle.body.type = Types.BODY_DYNAMIC; - particle.width *= collide; - particle.height *= collide; - } - else - { - //particle.body.allowCollisions = Types.NONE; - } - - particle.exists = false; - // Center the origin for rotation assistance - //particle.transform.origin.setTo(particle.body.bounds.halfWidth, particle.body.bounds.halfHeight); - - this.add(particle); - - i++; - } - - return this; - } - - public preUpdate() { } - public postUpdate() { } - - /** - * Called automatically by the game loop, decides when to launch particles and when to "die". - */ - public update() { - - if (this.on) - { - if (this._explode) - { - this.on = false; - - var i: number = 0; - var l: number = this._quantity; - - if ((l <= 0) || (l > this.length)) - { - l = this.length; - } - - while (i < l) - { - this.emitParticle(); - i++; - } - - this._quantity = 0; - } - else - { - this._timer += this.game.time.elapsed; - - while ((this.frequency > 0) && (this._timer > this.frequency) && this.on) - { - this._timer -= this.frequency; - this.emitParticle(); - - if ((this._quantity > 0) && (++this._counter >= this._quantity)) - { - this.on = false; - this._quantity = 0; - } - } - } - } - - super.update(); - - } - - /** - * Call this function to turn off all the particles and the emitter. - */ - public kill() { - this.on = false; - this.alive = false; - this.exists = false; - } - - /** - * Handy for bringing game objects "back to life". Just sets alive and exists back to true. - * In practice, this is most often called byObject.reset(). - */ - public revive() { - this.alive = true; - this.exists = true; - } - - /** - * Call this function to start emitting particles. - * - * @param explode {boolean} Whether the particles should all burst out at once. - * @param lifespan {number} How long each particle lives once emitted. 0 = forever. - * @param frequency {number} Ignored if Explode is set to true. Frequency is how often to emit a particle. 0 = never emit, 0.1 = 1 particle every 0.1 seconds, 5 = 1 particle every 5 seconds. - * @param quantity {number} How many particles to launch. 0 = "all of the particles". - */ - public start(explode: boolean = true, lifespan: number = 0, frequency: number = 0.1, quantity: number = 0) { - - this.revive(); - - this.visible = true; - this.on = true; - - this._explode = explode; - this.lifespan = lifespan; - this.frequency = frequency; - this._quantity += quantity; - - this._counter = 0; - this._timer = 0; - - } - - /** - * This function can be used both internally and externally to emit the next particle. - */ - public emitParticle() { - - var particle: ArcadeParticle = this.recycle(ArcadeParticle); - - particle.lifespan = this.lifespan; - //particle.body.bounce.setTo(this.bounce, this.bounce); - SpriteUtils.reset(particle, this.x - (particle.width >> 1) + this.game.rnd.integer * this.width, this.y - (particle.height >> 1) + this.game.rnd.integer * this.height); - particle.visible = true; - - if (this.minParticleSpeed.x != this.maxParticleSpeed.x) - { - particle.body.velocity.x = this.minParticleSpeed.x + this.game.rnd.integer * (this.maxParticleSpeed.x - this.minParticleSpeed.x); - } - else - { - particle.body.velocity.x = this.minParticleSpeed.x; - } - - if (this.minParticleSpeed.y != this.maxParticleSpeed.y) - { - particle.body.velocity.y = this.minParticleSpeed.y + this.game.rnd.integer * (this.maxParticleSpeed.y - this.minParticleSpeed.y); - } - else - { - particle.body.velocity.y = this.minParticleSpeed.y; - } - - //particle.body.acceleration.y = this.gravity; - - if (this.minRotation != this.maxRotation && this.minRotation !== 0 && this.maxRotation !== 0) - { - particle.body.angularVelocity = this.minRotation + this.game.rnd.integer * (this.maxRotation - this.minRotation); - } - else - { - particle.body.angularVelocity = this.minRotation; - } - - if (particle.body.angularVelocity != 0) - { - particle.rotation = this.game.rnd.integer * 360 - 180; - } - - //particle.body.drag.x = this.particleDrag.x; - //particle.body.drag.y = this.particleDrag.y; - particle.onEmit(); - - } - - /** - * A more compact way of setting the width and height of the emitter. - * - * @param width {number} The desired width of the emitter (particles are spawned randomly within these dimensions). - * @param height {number} The desired height of the emitter. - */ - public setSize(width: number, height: number) { - this.width = width; - this.height = height; - } - - /** - * A more compact way of setting the X velocity range of the emitter. - * - * @param Min {number} The minimum value for this range. - * @param Max {number} The maximum value for this range. - */ - public setXSpeed(min: number = 0, max: number = 0) { - this.minParticleSpeed.x = min; - this.maxParticleSpeed.x = max; - } - - /** - * A more compact way of setting the Y velocity range of the emitter. - * - * @param Min {number} The minimum value for this range. - * @param Max {number} The maximum value for this range. - */ - public setYSpeed(min: number = 0, max: number = 0) { - this.minParticleSpeed.y = min; - this.maxParticleSpeed.y = max; - } - - /** - * A more compact way of setting the angular velocity constraints of the emitter. - * - * @param Min {number} The minimum value for this range. - * @param Max {number} The maximum value for this range. - */ - public setRotation(min: number = 0, max: number = 0) { - this.minRotation = min; - this.maxRotation = max; - } - - /** - * Change the emitter's midpoint to match the midpoint of aObject. - * - * @param Object {object} TheObjectthat you want to sync up with. - */ - public at(object: Sprite) { - //this.x = object.body.bounds.halfWidth - (this.width >> 1); - //this.y = object.body.bounds.halfHeight - (this.height >> 1); - } - } - -} \ No newline at end of file diff --git a/todo/ArcadeParticle.ts b/todo/ArcadeParticle.ts deleted file mode 100644 index 018119d7..00000000 --- a/todo/ArcadeParticle.ts +++ /dev/null @@ -1,64 +0,0 @@ -///-/// - -/** -* Phaser - ArcadeParticle -* -* This is a simple particle class that extends a Sprite to have a slightly more -* specialised behaviour. It is used exclusively by the Emitter class and can be extended as required. -*/ - -module Phaser { - - export class ArcadeParticle extends Sprite { - - /** - * Instantiate a new particle. Like Sprite, all meaningful creation - * happens duringloadGraphic()ormakeGraphic()or whatever. - */ - constructor(game: Game) { - - super(game); - - this.body.type = Types.BODY_DYNAMIC; - this.lifespan = 0; - - } - - /** - * How long this particle lives before it disappears. - * NOTE: this is a maximum, not a minimum; the object - * could get recycled before its lifespan is up. - */ - public lifespan: number; - - /** - * The particle's main update logic. Basically it checks to see if it should be dead yet. - */ - public update() { - - // Lifespan behavior - if (this.lifespan <= 0) - { - return; - } - - this.lifespan -= this.game.time.elapsed; - - if (this.lifespan <= 0) - { - this.kill(); - } - - } - - /** - * Triggered whenever this object is launched by aEmitter. - * You can override this to add custom behavior like a sound or AI or something. - */ - public onEmit() { - } - - } - -} \ No newline at end of file diff --git a/todo/README.md b/todo/README.md new file mode 100644 index 00000000..a2762b7a --- /dev/null +++ b/todo/README.md @@ -0,0 +1,553 @@ +Phaser +====== + +Version: 1.0.0 - Released: August 2013 + +By Richard Davey, [Photon Storm](http://www.photonstorm.com) + +Phaser is a 2D JavaScript/TypeScript HTML5 Game Framework based heavily on [Flixel](http://www.flixel.org). + +Follow on [Twitter](https://twitter.com/photonstorm)
+Read the [Development Blog](http://www.photonstorm.com)
+Join the [Support Forum](http://www.html5gamedevs.com/forum/14-phaser/) + +Try out the [Phaser Test Suite](http://gametest.mobi/phaser/) + + + +"Being negative is not how we make progress" - Larry Page, Google + +Known Issues +------------ + +* The TypeScript 0.9.1 compiler is NOT production ready and is full of bugs. I tried my best to support it but I can't in all honesty +recommend it to anyone, so have reverted back to TypeScript 0.8.3 which works flawlessly. Sorry everyone. I'll try upgrading again in +the future when they sort it out. + +* Input detection on Sprites/Buttons doesn't work if the CAMERA is rotated or scaled. + +Future Plans +------------ + +* Ability to layer another DOM object and have it controlled by the game somehow. Can then do stacked canvas effects. +* Add ability to create extras within the game container, layered above/below the canvas +* Basic Window UI component (maybe a propogating Group?) +* Add clip support + shape options to Texture Component. +* Tilemap: remove tiles of a certain type, replace tile with sprite, change layer order, Tiled object support. +* Joypad support. +* Gestures input class. +* Integrate the Advanced Physics system that is 90% ready but needs updating for TypeScript 0.9.1. + + +ToDo before release +------------------- + +* Move embedded Phaser logo outside or swap for canvas calls +* Put Device.getAll elsewhere (plugin? utils?) +* Investigate bug re: tilemap collision and animation frames +* Sprite collision events +* Check bounds/edge points when sprite is only 1x1 sized :) +* QuadTree.physics.checkHullIntersection +* Sprite.transform.bottomRight/Left doesn't seem to take origin into account +* When game paused should mute-all then resume-all sounds? +* Bitmap Font support +* Pixel-perfect click check +* Check Flash atlas export is working +* DynamicTexture.setPixel needs to be swapped for a proper pixel put, not the filledRect it currently is. +* Check multi-game support (2+ games on one page) +* Finish the Docs! +* Getting Started guide! +* Sprite Sheet / Atlas support for Dynamic Textures +* Check browser support: OS X and iOS7 + Chrome Android latest +* Tweening + collision - what happens? + + +Mobile Optimisation Suggestions +------------------------------- + +* Camera.directToStage +* Stage.clear + +Latest Update +------------- + +V1.0.0 + +* Massive refactoring across the entire codebase. +* Removed Basic and GameObject and put Sprite on a diet. 127 properties and methods cut down to 32. +* Added a new headless renderer for non-display related performance testing. +* Added camera type to the CameraManager for future non-orthographic cameras. +* Added Camera.destroy - now clears down the FX and unregisters itself from the CameraManager. +* Added Camera.hide/show to hide Sprites or Groups from rendering (and removed corresponding hideFromCamera methods from Sprites/Groups) +* Heavily optimised Group so it no longer creates any temporary variables in any methods. +* Added Game.renderer which can be HEADLESS, CANVAS or WEBGL (coming soon) +* Added Sprite.render which is a reference to IRenderer.renderSprite, but can be overridden for custom handling. +* Refactored QuadTree so it no longer creates any temporary variables in any methods. +* The Sprite Renderer now uses a single setTransform for scale, rotation and translation that respects the Sprite.origin value in all cases. +* Sprite.modified is set to true if scale, rotation, skew or flip have been used. +* Added Tween.loop property so they can now re-run themselves indefinitely. +* Added Tween.yoyo property so they can reverse themselves after completing. +* Added Gravity to the Physics component. +* Removed Sprite.angle - use Sprite.rotation instead +* Optimised separateX/Y and overlap so they don't use any temporary vars any more. +* Added the new Physics.Body object to all Sprites. Used for all physics calculations in-game. Will be extended for Fixtures/Joints in future. +* Added SpriteUtils.setOriginToCenter to quickly set the origin of a sprite based on either frameBounds or body.bounds +* Added Sprite.Input component for tracking Input events over a Sprite +* Added Sprite.Input.useHandCursor (for desktop) +* Added Sprite.Input.justOver and justOut with a configurable ms delay +* Added Sprite.Events component for a global easy to access area to listen to events from +* Added Group.ID, each Group has a unique ID. Added Sprite.group (and Group.group) which is a reference to the Group it was added to. +* Added Group.addNewSprite(x,y,key) for quick addition of new Sprites to a Group +* Fixed Group.sort so the sortHandler is called correctly +* Added Group.swap(a,b) to swap the z-index of 2 objects with optional rendering update boolean +* Sprites dispatch new events for: killed, revived, added to Group and removed from Group. +* Added Input drag, bounds, sprite bounds and snapping support. +* Added the new ColorUtils class full of lots of handy color manipulation functions. +* Fixed issue in Camera.inCamera check where it wouldn't take into consideration the Sprites scrollFactor. +* Fixed issue with JSON Atlas loader incorrectly parsing the frames array. +* Fixed bug in FrameData.getFrameByName where the first frame of the array would always be skipped. +* Fixed bug where the Stage.backgroundColor property wasn't being saved correctly. +* Made Stage.bootScreen and Stage.pauseScreen public so you can override them with your own States now. +* Added the new OrientationScreen and Stage.enableOrientationCheck to allow for easy 'portrait/landscape only' game handling. +* Added fix to StageScaleMode for 180 degree portrait orientation on iPad. +* Added fix to orientation check so that it updates the input offsets correctly on rotation. +* Added support for minWidth and minHeight to game scale size, so it can never go below those values when scaling. +* Vastly improved orientation detection and response speed. +* Added custom callback support for all Touch and Mouse Events so you can easily hook events to custom APIs. +* Updated Game.loader and its methods. You now load images by: game.load.image() and also: game.load.atlas, game.load.audio, game.load.spritesheet, game.load.text. And you start it with game.load.start(). +* Added optional frame parameter to Phaser.Sprite (and game.add.sprite) so you can set a frame ID or frame name on construction. +* Fixed bug where passing a texture atlas string would incorrectly skip the frames array. +* Added AnimationManager.autoUpdateBounds to control if a new frame should change the physics bounds of a sprite body or not. +* Added StageScaleMode.pageAlignHorizontally and pageAlignVertically booleans. When true Phaser will set the margin-left and top of the canvas element so that it is positioned in the middle of the page (based only on window.innerWidth). +* Added support for globalCompositeOperation, opaque and backgroundColor to the Sprite.Texture and Camera.Texture components. +* Added ability for a Camera to skew and rotate around an origin. +* Moved the Camera rendering into CanvasRenderer to keep things consistent. +* Added Stage.setImageRenderingCrisp to quickly set the canvas image-rendering to crisp-edges (note: poor browser support atm) +* Sprite.width / height now report the scaled width height, setting them adjusts the scale as it does so. +* Created a Transform component containing scale, skew, rotation, scrollFactor, origin and rotationOffset. Added to Sprite, Camera, Group. +* Created a Texture component containing image data, alpha, flippedX, flippedY, etc. Added to Sprite, Camera, Group. +* Added CameraManager.swap and CameraManager.sort methods and added a z-index property to Camera to control render order. +* Added World.postUpdate loop + Group and Camera postUpdate methods. +* Fixed issue stopping Pointer from working in world coordinates and fixed the world drag example. +* For consistency renamed input.scaledX/Y to input.scale. +* Added input.activePointer which contains a reference to the most recently active pointer. +* Sprite.Transform now has upperLeft, upperRight, bottomLeft and bottomRight Point properties and lots of useful coordinate related methods. +* Camera.inCamera check now uses the Sprite.worldView which finally accurately updates regardless of scale, rotation or rotation origin. +* Added Math.Mat3 for Matrix3 operations (which Sprite.Transform uses) and Math.Mat3Utils for lots of use Mat3 related methods. +* Added SpriteUtils.overlapsXY and overlapsPoint to check if a point is within a sprite, taking scale and rotation into account. +* Added Cache.getImageKeys (and similar) to return an array of all the keys for all currently cached objects. +* Added Group.bringToTop feature. Will sort the Group, move the given sprites z-index to the top and shift the rest down by one. +* Brand new Advanced Physics system added and working! Woohoo :) +* Fixed issue in Tilemap.parseTiledJSON where it would accidentally think image and object layers were map data. +* Fixed bug in Group.bringToTop if the child didn't have a group property yet. +* Fixed bug in FrameData.checkFrameName where the first index of the _frameNames array would be skipped. +* Added isRunning boolean property to Phaser.Tween +* Moved 'facing' property from Sprite.body to Sprite.texture (may move to Sprite core) +* Added Sprite.events.onDragStart and onDragStop +* A tilemap can now be loaded without a tile sheet, should you just want to get the tile data from it and not render. +* Added new Sprite.events: onAnimationStart, onAnimationComplete, onAnimationLoop +* Added in support for the Input component PriorityID value and refactored Input.Pointer to respect it. Rollovers are perfect now :) +* Added 2 new State functions: loadRender and loadUpdate, are called the same as render and update but only during the load process +* Fixed Input.stopDrag so it fires an onInputUp event as well from the sprite. +* Added support for a preRender state - very useful for certain types of special effects. +* Cameras are now limited so they can never be larger than the Game.Stage size. +* Added a new Button Game Object for easily creating in-game UI and menu systems. +* Fixed bug where Sprite.alpha wasn't properly reflecting Sprite.texture.alpha. +* Fixed bug where the hand cursor would be reset on input up, even if the mouse was still over the sprite. +* Fixed bug where pressing down then moving out of the sprite area wouldn't properly reset the input state next time you moved over the sprite. +* Added the Sprite.tween property, really useful to avoid creating new tween vars in your local scope if you don't need them. +* Added support for pagehide and pageshow events to Stage, hooked in to the pause/resume game methods. +* Extended Device audio checks to include opus and webm. +* Updated Loader and Cache so they now support loading of Audio() tags as well as Web Audio. +* Set Input.recordPointerHistory to false, you now need to enable the pointer tracking if you wish to use it. +* SoundManager will now automatically handle iOS touch unlocking. +* Added TilemapLayer.putTileWorldXY to place a tile based on pixel values, and putTile based on tile map coordinates. +* Dropped the StageScaleMode.setScreenSize iterations count from 40 down to 10 and document min body height to 2000px. +* Added Phaser.Net for browser and network specific functions, currently includes query string parsing and updating methods. +* Added a new CSS3 Filters component. Apply blur, grayscale, sepia, brightness, contrast, hue rotation, invert, opacity and saturate filters to the games stage. +* Fixed the CircleUtils.contains and containsPoint methods. +* Fixed issue with Input.speed values being too high on new touch events. +* Added Sprite.bringToTop() +* Added Stage.disableVisibilityChange to stop the auto pause/resume from ever firing. +* Added crop support to the Texture component, so you can do Sprite.crop to restrict rendering to a specified Rectangle without distortion. +* Added references to all the event listener functions so they can be cleanly destroyed. +* Fixed interesting Firefox issue when an audio track ended it fired another 'canplaythrough' event, confusing the Loader. +* Added the new PluginManager. Moved all the Camera FX over to plugins. Everything will be a plugin from now on. +* Added Sprite.transform.centerOn(x,y) to quickly center a sprite on a coordinate without messing with the sprite origin and regardless of rotation. +* Added Input.pollRate - this lets you limit how often Pointer events are handled (0 = every frame, 1 = every other frame, etc) +* Renamed the 'init' function to 'preload'. It now calls load.start automatically. +* Added CanvasUtils class, including ability to set image rendering, add a canvas to the dom and other handy things. + + +V0.9.6 + +* Virtually every class now has documentation - if you spot a typo or something missing please shout (thanks pixelpicosean). +* Grunt file updated to produce the new Special FX JS file (thanks HackManiac). +* Fixed issue stopping Phaser working on iOS 5 (iPad 1). +* Created new mobile test folder, updated index.php to use mobile CSS and made some mobile specific tests. +* Fixed a few speed issues on Android 2.x stock browser. +* Moved Camera context save/restore back inside parameter checks (sped-up Samsung S3 stock browser). +* Fixed bug with StageScaleMode.checkOrientation not respecting the NO_SCALE value. +* Added MSPointer support (thanks Diego Bezerra). +* Added Camera.clear to perform a clearRect instead of a fillRect if needed (default is false). +* Swapped Camera.opaque default from true to false re: performance. +* Updated Stage.visibilityChange to avoid pause screen locking in certain situations. +* Added StageScaleMode.enterLandscape and enterPortrait signals for easier device orientation change checks. +* Added StageScaleMode.isPortrait. +* Updated StageScaleMode to check both window.orientationchange and window.resize events. +* Updated RequestAnimationFrame to use performance.now for sub-millisecond precision and to drive the Game.time.update loop. +* Updated RequestAnimationFrame setTimeout to use fixed timestep and re-ordered callback sequence. Android 2/iOS5 performance much better now. +* Removed Stage.ORIENTATION_LANDSCAPE statics because the values should be taken from Stage.scale.isPortrait / isLandscape. +* Removed Stage.maxScaleX/Y and moved them into StageScaleMode.minWidth, minHeight, maxWidth and maxHeight. +* Fixed Stage.scale so that it resizes without needing an orientation change first. +* Added StageScaleMode.startFullscreen(), stopFullScreen() and isFullScreen for making use of the FullScreen API on desktop browsers. +* Swapped Stage.offset from Point to MicroPoint. +* Swapped Stage.bounds from Rectangle to Quad. +* Added State.destroy support. A states destroy function is called when you switch to a new state (thanks JesseFreeman). +* Added Sprite.fillColor, used in the Sprite render if no image is loaded (set via the property or Sprite.makeGraphic) (thanks JesseFreeman). +* Renamed Phaser.Finger to Phaser.Pointer. +* Updated all of the Input classes so they now use Input.pointers 1 through 10. +* Updated Touch and MSPointer to allow multi-touch support (when the hardware supports it) and created new tests to show this. +* Added Input.getPointer, Input.getPointerFromIdentifier, Input.totalActivePointers and Input.totalInactivePointers. +* Added Input.startPointer, Input.updatePointer and Input.stopPointer. +* Phaser Input now confirmed working on Windows Phone 8 (Nokia Lumia 920). +* Added Input.maxPointers to allow you to limit the number of fingers your game will listen for on multi-touch systems. +* Added Input.addPointer. By default Input will create 5 pointers (+1 for the mouse). Use addPointer() to add up to a maximum of 10. +* Added Input.position - a Vector2 object containing the most recent position of the most recently active Pointer. +* Added Input.getDistance. Find the distance between the two given Pointer objects. +* Added Input.getAngle. Find the angle between the two given Pointer objects. +* Pointer.totalTouches value keeps a running total of the number of times the Pointer has been pressed. +* Added Pointer.position and positionDown. positionDown is placed on touch and position is update on move, useful for tracking distance/direction/gestures. +* Added Game.state - now contains a reference to the current state object (if any was given). +* Moved the Input start events from the constructors to a single Input.start method. +* Added Input.disabled boolean to globally turn off all input event processing. +* Added Input.Mouse.disabled, Input.Touch.disabled, Input.MSPointer.disabled and Input.Keyboard.disabled. +* Added Device.mspointer boolean. true if MSPointer is available on the device. +* Added Input.onDown, onUp, onTap, onDoubleTap and onHold signals - all fired by the mouse or touch. +* Added Input.recordPointerHistory to record the x/y coordinates a Pointer tracks through. Also Input.recordRate and Input.recordLimit for fine control. +* Added Input.multiInputOverride which can be MOUSE_OVERRIDES_TOUCH, TOUCH_OVERRIDES_MOUSE or MOUSE_TOUCH_COMBINE. +* Added GameObject.setBoundsFromWorld to quickly set the bounds of a game object to match those of the current game world. +* Added GameObject.canvas and GameObject.context. By default they reference Stage.canvas but can be changed to anything, i.e. a DynamicTexture +* The new canvas and context references are applied to Sprite, GeomSprite and TilemapLayer +* Added DynamicTexture.assignCanvasToGameObjects() to allow you to redirect GameObject rendering en-mass to a DynamicTexture +* Added DynamicTexture.render(x,y) to render the texture to the Stage canvas +* Added Basic.ignoreGlobalUpdate - stops the object being updated as part of the main game loop, you'll need to call update on it yourself +* Added Basic.ignoreGlobalRender - stops the object being rendered as part of the main game loop, you'll need to call render on it yourself +* Added forceUpdate and forceRender parameters to Group.update and Group.render respectively. Combined with ignoreGlobal you can create custom rendering set-ups +* Fixed Loader.progress calculation so it now accurately passes a value between 0 and 100 to your loader callback +* Added a 'hard reset' parameter to Input.reset. A hard reset clears Input signals (such as on a state swap), a soft (such as on game pause) doesn't +* Added Device.isConsoleOpen() to check if the browser console is open. Tested on Firefox with Firebug and Chrome with DevTools +* Added delay parameter to Tween.to() +* Fixed bug where GeomSprite.renderOutline was being ignored for Circle objects +* Fixed bug with GeomSprite circles rendering at twice the size they should have been and offset from actual x/y values +* Added Sprite.cacheKey which stores the key of the item from the cache that was used for its texture (if any) +* Added GameMath.shuffleArray +* Updated Animation.frame to return the index of the currentFrame if set +* Added Quad.copyTo and Quad.copyFrom +* Removed the bakedRotations parameter from Emiter.makeParticles - update your code accordingly! +* Updated various classes to remove the Flixel left-over CamelCase parameters +* Updated QuadTree to use the new CollisionMask values and significantly optimised and reduced overall class size +* Updated Collision.seperate to use the new CollisionMask +* Added a callback context parameter to Game.collide, Collision.overlap and the QuadTree class +* Stage.canvas now calls preventDefault() when the context menu is activated (oncontextmenu) +* Added Point.rotate to allow you to rotate a point around another point, with optional distance clamping. Also created test cases. +* Added Group.alpha to apply a globalAlpha before the groups children are rendered. Useful to save on alpha calls. +* Added Group.globalCompositeOperation to apply a composite operation before all of the groups children are rendered. +* Added Camera black list support to Sprite and Group along with Camera.show, Camera.hide and Camera.isHidden methods to populate them. +* Added GameMath.rotatePoint to allow for point rotation at any angle around a given anchor and distance +* Updated World.setSize() to optionally update the VerletManager dimensions as well +* Added GameObject.setPosition(x, y) +* Added Quad.intersectsRaw(left, right, top, bottom, tolerance) +* Updated Sprite.inCamera to correctly apply the scrollFactor to the camera bounds check +* Added Loader.crossOrigin property which is applied to loaded Images +* Added AnimationManager.destroy() to clear out all local references and objects +* Added the clearAnimations parameter to Sprite.loadGraphic(). Allows you to change animation textures but retain the frame data. +* Added the GameObjectFactory to Game. You now make Sprites like this: game.add.sprite(). Much better separation of game object creation methods now. But you'll have to update ALL code, sorry! (blame JesseFreeman for breaking your code and coming up with the idea :) +* Added GameObjectFactory methods to add existing objects to the game world, such as existingSprite(), existingTween(), etc. +* Added the GameObjectFactory to Phaser.State +* Added new format parameter to Loader.addTextureAtlas defining the format. Currently supported: JSON Array and Starling/Sparrow XML. + +Requirements +------------ + +Games created with Phaser require a modern web browser that supports the canvas tag. This includes Internet Explorer 9+, Firefox, Chrome, Safari and Opera. It also works on mobile web browsers including stock Android 2.x browser and above and iOS5 Mobile Safari and above. + +For developing with Phaser you can use either a plain-vanilla JavaScript approach or [TypeScript](https://typescript.codeplex.com/). We made no assumptions about how you like to code your games, and were careful not to impose any form of class/inheritance/structure upon you. + +If you are compiling via TypeScript from the command-line please use `--target ES5` + +If you need it the included Grunt file will generate a RequireJS/CommonJS version of Phaser on build. + +Phaser is just 45KB gzipped and minified. + +Features +-------- + +Phaser was born from a cross-pollination of the AS3 Flixel game library and our own internal HTML5 game framework. The objective was to allow you to make games _really_ quickly and remove some of the speed barriers HTML5 puts in your way. + +Phaser fully or partially supports the following features. This list is growing constantly and we are aware there are still a number of essential features missing: + +* Asset Loading
+ + Images, Sprite Sheets, Texture Packer Data, JSON, Text Files, Audio File. + +* Cameras
+ + Multiple world cameras, camera scale, zoom, rotation, deadzones and Sprite following. + +* Sprites
+ + All sprites have physics properties including velocity, acceleration, bounce and drag. + ScrollFactor allows them to re-act to cameras at different rates. + +* Groups
+ + Group sprites together for collision checks, visibility toggling and function iteration. + +* Animation
+ + Sprites can be animated by a sprite sheet or Texture Atlas (JSON Array format supported). + Animation playback controls, looping, fps based timer and custom frames. + +* Scroll Zones
+ + Scroll any image seamlessly in any direction. Or create multiple scrolling regions within an image. + +* Collision
+ + A QuadTree based Sprite to Sprite, Sprite to Group or Group to Group collision system. + +* Particles
+ + An Emitter can emit Sprites in a burst or at a constant rate, setting physics properties. + +* Input
+ + Keyboard, Mouse and Touch handling supported (MSPointer events coming soon) + +* Stage
+ + Easily change properties about your game via the stage, such as background color, position, size and scale. + +* World
+ + The game world can be any size and Sprites and collision happens within it. + +* Sound
+ + Currently uses WebAudio for playback. A lot more work needs to be done in this area. + +* State Management
+ + For larger games it's useful to break your game down into States, i.e. MainMenu, Level1, GameOver, etc. + The state manager makes swapping states easy, but the use of a state is completely optional. + +* Cache
+ + All loaded resources are stored in an easy to access cache, which can be cleared between State changes + or persist through-out the whole game. + +* Tilemaps
+ + Support for CSV and Tiled JSON format tile maps. Supports Layered Tiled maps and layer based collision. + +* Game Scaling
+ + Game scaling under your control. Removes URL/status bar on mobile (iOS and Android) and allows proportional scaling, fixed size and orientation checks. + + + +Work in Progress +---------------- + +We've a number of features that we know Phaser is lacking, here is our current priority list: + +* Better sound controls +* Text Rendering +* Buttons +* Google Play Game Services + +Beyond this there are lots of other things we plan to add such as WebGL support, Spine animation format support, sloped collision tiles, path finding and support for custom plugins. But the list above are priority items, and by no means exhaustive either! However we do feel that the core structure of Phaser is now tightly locked down, so safe to use for small scale production games. + +Test Suite +---------- + +Phaser comes with an ever growing Test Suite. Personally we learn better by looking at small refined code examples, so we create lots of them to test each new feature we add. Inside the Tests folder you'll find the current set. If you write a particularly good test then please send it to us. + +The tests need running through a local web server (to avoid file access permission errors from your browser). + +Make sure you can browse to the Tests folder via your web server. If you've got php installed then launch: + + Tests/index.php + +Right now the Test Suite requires PHP, but we will remove this requirement soon. + +You can also browse the [Phaser Test Suite](http://gametest.mobi/phaser/) online. + +Contributing +------------ + +Phaser is in early stages and although we've still got a lot to add to it, we wanted to just get it out there and share it with the world. + +If you find a bug (highly likely!) then please report it on github. + +If you have a feature request, or have written a small game or demo that shows Phaser in use, then please get in touch. We'd love to hear from you. + +You can do this on the Phaser board that is part of the [HTML5 Game Devs forum](http://www.html5gamedevs.com/forum/14-phaser/) or email: rich@photonstorm.com + +Bugs? +----- + +Please add them to the [Issue Tracker][1] with as much info as possible. + + + +Change Log +---------- + +V0.9.5 + +* Moved the BootScreen and PauseScreen out of Stage into their own classes (system/screens/BootScreen and PauseScreen). +* Updated the PauseScreen to show a subtle animation effect, making it easier to create your own interesting pause screens. +* Modified Game so it splits into 3 loops - bootLoop, pauseLoop and loop (the core loop). +* Updated the BootScreen with the new logo and new color cycle effect. +* Added Game.isRunning - set to true once the Game.boot process is over IF you gave some functions to the constructor or a state. +* Fixed small bug in Signal.removeAll where it could try to shorten the _bindings even if undefined. +* Added the new FXManager which is used for handling all special effects on Cameras (and soon other game objects). +* Removed Flash, Fade and Shake from the Camera class and moved to the new SpecialFX project. +* SpecialFX compiles to phaser-fx.js in the build folder, which is copied over to Tests. If you don't need the FX, don't include the .js file. +* The project is now generating TypeScript declaration files and all Tests were updated to use them in their references. +* Fixed a bug in Flash, Fade and Shake where the duration would fail on anything above 3 seconds. +* Fixed a bug in Camera Shake that made it go a bit haywire, now shakes correctly. +* Added new Scanlines Camera FX. +* Fixed offset values being ignored in GeomSprite.renderPoint (thanks bapuna). +* Added new Mirror Camera FX. Can mirror the camera image horizontally, vertically or both with an optional fill color overlay. +* Added Camera.disableClipping for when you don't care about things being drawn outside the edge (useful for some FX). +* Updated TilemapLayer so that collision data is now stored in _tempTileBlock to avoid constant array creation during game loop. +* TilemapLayer.getTileOverlaps() now returns all tiles the object overlapped with rather than just a boolean. +* Tilemap.collide now optionally takes callback and context parameters which are used if collision occurs. +* Added Tilemap.collisionCallback and Tilemap.collisionCallbackContext so you can set them once and not re-set them on every call to collide. +* Collision.separateTile now has 2 extra parameters: separateX and separateY. If true the object will be separated on overlap, otherwise just the overlap boolean result is returned. +* Added Tile.separateX and Tile.separateY (both true by default). Set to false if you don't want a tile to stop an object from moving, you just want it to return collision data to your callback. +* Added Tilemap.getTileByIndex(value) to access a specific type of tile, rather than by its map index. +* Added TilemapLayer.putTile(x,y,index) - allows you to insert new tile data into the map layer (create your own tile editor!). +* TilemapLayer.getTileBlock now returns a unique Array of map data, not just a reference to the temporary block array +* Added TilemapLayer.swapTile - scans the given region of the map for all instances of tileA and swaps them for tileB, and vice versa. +* Added TilemapLayer.replaceTile - scans the given region of the map and replaces all instances of tileA with tileB. tileB is left unaffected. +* Added TilemapLayer.fillTiles - fills the given region of the map with the tile specified. +* Added TilemapLayer.randomiseTiles - fills the given region of the map with a random tile from the list specified. +* Added fun new "map draw" test - rebound those carrots! :) +* Changed SoundManager class to respect volume on first play (thanks initials and hackmaniac) + +V0.9.4 + +* Added Tilemap.getTile, getTileFromWorldXY, getTileFromInputXY +* Added Tilemap.setCollisionByIndex and setCollisionByRange +* Added GameObject.renderRotation boolean to control if the sprite will visually rotate or not (useful when angle needs to change but graphics don't) +* Added additional check to Camera.width/height so you cannot set them larger than the Stage size +* Added Collision.separateTile and Tilemap.collide +* Fixed Tilemap bounds check if map was smaller than game dimensions +* Fixed: Made World._cameras public, World.cameras and turned Game.camera into a getter for it (thanks Hackmaniac) +* Fixed: Circle.isEmpty properly checks diameter (thanks bapuna) +* Updated Gruntfile to export new version of phaser.js wrapped in a UMD block for require.js/commonJS (thanks Hackmaniac) + +V0.9.3 + +* Added the new ScrollZone game object. Endlessly useful but especially for scrolling backdrops. Created 6 example tests. +* Added GameObject.hideFromCamera(cameraID) to stop an object rendering to specific cameras (also showToCamera and clearCameraList) +* Added GameObject.setBounds() to confine a game object to a specific area within the world (useful for stopping them going off the edges) +* Added GameObject.outOfBoundsAction, can be either OUT OF BOUNDS STOP which stops the object moving, or OUT OF BOUNDS KILL which kills it. +* Added GameObject.rotationOffset. Useful if your graphics need to rotate but weren't drawn facing zero degrees (to the right). +* Added shiftSinTable and shiftCosTable to the GameMath class to allow for quick iteration through the data tables. +* Added more robust frame checking into AnimationManager +* Re-built Tilemap handling from scratch to allow for proper layered maps (as exported from Tiled / Mappy) +* Tilemap no longer requires a buffer per Camera (in prep for WebGL support) +* Fixed issues with Group not adding reference to Game to newly created objects (thanks JesseFreeman) +* Fixed a potential race condition issue in Game.boot (thanks Hackmaniac) +* Fixed issue with showing frame zero of a texture atlas before the animation started playing (thanks JesseFreeman) +* Fixed a bug where Camera.visible = false would still render +* Removed the need for DynamicTextures to require a key property and updated test cases. +* You can now pass an array or a single value to Input.Keyboard.addKeyCapture(). + +V0.9.2 + +* Fixed issue with create not being called if there was an empty init method. +* Added ability to flip a sprite (Sprite.flipped = true) + a test case for it. +* Added ability to restart a sprite animation. +* Sprite animations don't restart if you call play on them when they are already running. +* Added Stage.disablePauseScreen. Set to true to stop your game pausing when the tab loses focus. + +V0.9.1 + +* Added the new align property to GameObjects that controls placement when rendering. +* Added an align example to the Sprites test group (click the mouse to change alignment position) +* Added a new MicroPoint class. Same as Point but much smaller / less functions, updated GameObject to use it. +* Completely rebuilt the Rectangle class to use MicroPoints and store the values of the 9 points around the edges, to be used +for new collision system. +* Game.Input now has 2 signals you can subscribe to for down/up events, see the Sprite align example for use. +* Updated the States examples to bring in-line with 0.9 release. + +V0.9 + +* Large refactoring. Everything now lives inside the Phaser module, so all code and all tests have been updated to reflect this. Makes coding a tiny bit more verbose but stops the framework from globbing up the global namespace. Also should make code-insight work in WebStorm and similar editors. +* Added the new GeomSprite object. This is a sprite that uses a geometry class for display (Circle, Rectangle, Point, Line). It's extremely flexible! +* Added Geometry intersection results objects. +* Added new Collision class and moved some functions there. Contains all the Game Object and Geometry Intersection methods. +* Can now create a sprite animation based on frame names rather than indexes. Useful when you've an animation inside a texture atlas. Added test to show. +* Added addKeyCapture(), removeKeyCapture() and clearCaptures() to Input.Keyboard. Calls event.preventDefault() on any keycode set to capture, allowing you to avoid page scrolling when using the cursor keys in a game for example. +* Added new Motion class which contains lots of handy functions like 'moveTowardsObject', 'velocityFromAngle' and more. +* Tween Manager added. You can now create tweens via Game.createTween (or for more control game.tweens). All the usual suspects are here: Bounce, * Elastic, Quintic, etc and it's hooked into the core game clock, so if your game pauses and resumes your tweens adjust accordingly. + +V0.8 + +* Added ability to set Sprite frame by name (sprite.frameName), useful when you've loaded a Texture Atlas with filename values set rather than using frame indexes. +* Updated texture atlas 4 demo to show this. +* Fixed a bug that would cause a run-time error if you tried to create a sprite using an invalid texture key. +* Added in DynamicTexture support and a test case for it. + +V0.7 + +* Renamed FullScreen to StageScaleMode as it's much more fitting. Tested across Android and iOS with the various scale modes. +* Added in world x/y coordinates to the input class, and the ability to get world x/y input coordinates from any Camera. +* Added the RandomDataGenerator for seeded random number generation. +* Setting the game world size now resizes the default camera (optional bool flag) + +V0.6 + +* Added in Touch support for mobile devices (and desktops that enable it) and populated x/y coords in Input with common values from touch and mouse. +* Added new Circle geometry class (used by Touch) and moved them into a Geom folder. +* Added in Device class for device inspection. +* Added FullScreen class to enable full-screen support on mobile devices (scrolls URL bar out of the way on iOS and Android) + +V0.5 + +* Initial release + + + +License +------- + +The MIT License (MIT) + +Copyright (c) 2013 Richard Davey, Photon Storm Ltd. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +[1]: https://github.com/photonstorm/phaser/issues +[phaser]: https://github.com/photonstorm/phaser diff --git a/TS Source/.gitignore b/todo/TS Source/.gitignore similarity index 100% rename from TS Source/.gitignore rename to todo/TS Source/.gitignore diff --git a/TS Source/Game.js b/todo/TS Source/Game.js similarity index 100% rename from TS Source/Game.js rename to todo/TS Source/Game.js diff --git a/TS Source/Game.ts b/todo/TS Source/Game.ts similarity index 100% rename from TS Source/Game.ts rename to todo/TS Source/Game.ts diff --git a/TS Source/Phaser.js b/todo/TS Source/Phaser.js similarity index 100% rename from TS Source/Phaser.js rename to todo/TS Source/Phaser.js diff --git a/TS Source/Phaser.ts b/todo/TS Source/Phaser.ts similarity index 100% rename from TS Source/Phaser.ts rename to todo/TS Source/Phaser.ts diff --git a/TS Source/Stage.js b/todo/TS Source/Stage.js similarity index 100% rename from TS Source/Stage.js rename to todo/TS Source/Stage.js diff --git a/TS Source/Stage.ts b/todo/TS Source/Stage.ts similarity index 100% rename from TS Source/Stage.ts rename to todo/TS Source/Stage.ts diff --git a/TS Source/State.js b/todo/TS Source/State.js similarity index 100% rename from TS Source/State.js rename to todo/TS Source/State.js diff --git a/TS Source/State.ts b/todo/TS Source/State.ts similarity index 100% rename from TS Source/State.ts rename to todo/TS Source/State.ts diff --git a/TS Source/Statics.js b/todo/TS Source/Statics.js similarity index 100% rename from TS Source/Statics.js rename to todo/TS Source/Statics.js diff --git a/TS Source/Statics.ts b/todo/TS Source/Statics.ts similarity index 100% rename from TS Source/Statics.ts rename to todo/TS Source/Statics.ts diff --git a/TS Source/World.js b/todo/TS Source/World.js similarity index 100% rename from TS Source/World.js rename to todo/TS Source/World.js diff --git a/TS Source/World.ts b/todo/TS Source/World.ts similarity index 100% rename from TS Source/World.ts rename to todo/TS Source/World.ts diff --git a/TS Source/_definitions.js b/todo/TS Source/_definitions.js similarity index 100% rename from TS Source/_definitions.js rename to todo/TS Source/_definitions.js diff --git a/TS Source/_definitions.ts b/todo/TS Source/_definitions.ts similarity index 100% rename from TS Source/_definitions.ts rename to todo/TS Source/_definitions.ts diff --git a/TS Source/animation/Animation.js b/todo/TS Source/animation/Animation.js similarity index 100% rename from TS Source/animation/Animation.js rename to todo/TS Source/animation/Animation.js diff --git a/TS Source/animation/Animation.ts b/todo/TS Source/animation/Animation.ts similarity index 100% rename from TS Source/animation/Animation.ts rename to todo/TS Source/animation/Animation.ts diff --git a/TS Source/animation/AnimationManager.js b/todo/TS Source/animation/AnimationManager.js similarity index 100% rename from TS Source/animation/AnimationManager.js rename to todo/TS Source/animation/AnimationManager.js diff --git a/TS Source/animation/AnimationManager.ts b/todo/TS Source/animation/AnimationManager.ts similarity index 100% rename from TS Source/animation/AnimationManager.ts rename to todo/TS Source/animation/AnimationManager.ts diff --git a/TS Source/animation/Frame.js b/todo/TS Source/animation/Frame.js similarity index 100% rename from TS Source/animation/Frame.js rename to todo/TS Source/animation/Frame.js diff --git a/TS Source/animation/Frame.ts b/todo/TS Source/animation/Frame.ts similarity index 100% rename from TS Source/animation/Frame.ts rename to todo/TS Source/animation/Frame.ts diff --git a/TS Source/animation/FrameData.js b/todo/TS Source/animation/FrameData.js similarity index 100% rename from TS Source/animation/FrameData.js rename to todo/TS Source/animation/FrameData.js diff --git a/TS Source/animation/FrameData.ts b/todo/TS Source/animation/FrameData.ts similarity index 100% rename from TS Source/animation/FrameData.ts rename to todo/TS Source/animation/FrameData.ts diff --git a/TS Source/cameras/Camera.js b/todo/TS Source/cameras/Camera.js similarity index 100% rename from TS Source/cameras/Camera.js rename to todo/TS Source/cameras/Camera.js diff --git a/TS Source/cameras/Camera.ts b/todo/TS Source/cameras/Camera.ts similarity index 100% rename from TS Source/cameras/Camera.ts rename to todo/TS Source/cameras/Camera.ts diff --git a/TS Source/cameras/CameraManager.js b/todo/TS Source/cameras/CameraManager.js similarity index 100% rename from TS Source/cameras/CameraManager.js rename to todo/TS Source/cameras/CameraManager.js diff --git a/TS Source/cameras/CameraManager.ts b/todo/TS Source/cameras/CameraManager.ts similarity index 100% rename from TS Source/cameras/CameraManager.ts rename to todo/TS Source/cameras/CameraManager.ts diff --git a/TS Source/core/Group.js b/todo/TS Source/core/Group.js similarity index 100% rename from TS Source/core/Group.js rename to todo/TS Source/core/Group.js diff --git a/TS Source/core/Group.ts b/todo/TS Source/core/Group.ts similarity index 100% rename from TS Source/core/Group.ts rename to todo/TS Source/core/Group.ts diff --git a/TS Source/core/Plugin.js b/todo/TS Source/core/Plugin.js similarity index 100% rename from TS Source/core/Plugin.js rename to todo/TS Source/core/Plugin.js diff --git a/TS Source/core/Plugin.ts b/todo/TS Source/core/Plugin.ts similarity index 100% rename from TS Source/core/Plugin.ts rename to todo/TS Source/core/Plugin.ts diff --git a/TS Source/core/PluginManager.js b/todo/TS Source/core/PluginManager.js similarity index 100% rename from TS Source/core/PluginManager.js rename to todo/TS Source/core/PluginManager.js diff --git a/TS Source/core/PluginManager.ts b/todo/TS Source/core/PluginManager.ts similarity index 100% rename from TS Source/core/PluginManager.ts rename to todo/TS Source/core/PluginManager.ts diff --git a/TS Source/core/Signal.js b/todo/TS Source/core/Signal.js similarity index 100% rename from TS Source/core/Signal.js rename to todo/TS Source/core/Signal.js diff --git a/TS Source/core/Signal.ts b/todo/TS Source/core/Signal.ts similarity index 100% rename from TS Source/core/Signal.ts rename to todo/TS Source/core/Signal.ts diff --git a/TS Source/core/SignalBinding.js b/todo/TS Source/core/SignalBinding.js similarity index 100% rename from TS Source/core/SignalBinding.js rename to todo/TS Source/core/SignalBinding.js diff --git a/TS Source/core/SignalBinding.ts b/todo/TS Source/core/SignalBinding.ts similarity index 100% rename from TS Source/core/SignalBinding.ts rename to todo/TS Source/core/SignalBinding.ts diff --git a/TS Source/display/CSS3Filters.js b/todo/TS Source/display/CSS3Filters.js similarity index 100% rename from TS Source/display/CSS3Filters.js rename to todo/TS Source/display/CSS3Filters.js diff --git a/TS Source/display/CSS3Filters.ts b/todo/TS Source/display/CSS3Filters.ts similarity index 100% rename from TS Source/display/CSS3Filters.ts rename to todo/TS Source/display/CSS3Filters.ts diff --git a/TS Source/display/DynamicTexture.js b/todo/TS Source/display/DynamicTexture.js similarity index 100% rename from TS Source/display/DynamicTexture.js rename to todo/TS Source/display/DynamicTexture.js diff --git a/TS Source/display/DynamicTexture.ts b/todo/TS Source/display/DynamicTexture.ts similarity index 100% rename from TS Source/display/DynamicTexture.ts rename to todo/TS Source/display/DynamicTexture.ts diff --git a/TS Source/display/Texture.js b/todo/TS Source/display/Texture.js similarity index 100% rename from TS Source/display/Texture.js rename to todo/TS Source/display/Texture.js diff --git a/TS Source/display/Texture.ts b/todo/TS Source/display/Texture.ts similarity index 100% rename from TS Source/display/Texture.ts rename to todo/TS Source/display/Texture.ts diff --git a/TS Source/gameobjects/Events.js b/todo/TS Source/gameobjects/Events.js similarity index 100% rename from TS Source/gameobjects/Events.js rename to todo/TS Source/gameobjects/Events.js diff --git a/TS Source/gameobjects/Events.ts b/todo/TS Source/gameobjects/Events.ts similarity index 100% rename from TS Source/gameobjects/Events.ts rename to todo/TS Source/gameobjects/Events.ts diff --git a/TS Source/gameobjects/GameObjectFactory.js b/todo/TS Source/gameobjects/GameObjectFactory.js similarity index 100% rename from TS Source/gameobjects/GameObjectFactory.js rename to todo/TS Source/gameobjects/GameObjectFactory.js diff --git a/TS Source/gameobjects/GameObjectFactory.ts b/todo/TS Source/gameobjects/GameObjectFactory.ts similarity index 100% rename from TS Source/gameobjects/GameObjectFactory.ts rename to todo/TS Source/gameobjects/GameObjectFactory.ts diff --git a/TS Source/gameobjects/IGameObject.ts b/todo/TS Source/gameobjects/IGameObject.ts similarity index 100% rename from TS Source/gameobjects/IGameObject.ts rename to todo/TS Source/gameobjects/IGameObject.ts diff --git a/TS Source/gameobjects/ScrollRegion.js b/todo/TS Source/gameobjects/ScrollRegion.js similarity index 100% rename from TS Source/gameobjects/ScrollRegion.js rename to todo/TS Source/gameobjects/ScrollRegion.js diff --git a/TS Source/gameobjects/ScrollRegion.ts b/todo/TS Source/gameobjects/ScrollRegion.ts similarity index 100% rename from TS Source/gameobjects/ScrollRegion.ts rename to todo/TS Source/gameobjects/ScrollRegion.ts diff --git a/TS Source/gameobjects/ScrollZone.js b/todo/TS Source/gameobjects/ScrollZone.js similarity index 100% rename from TS Source/gameobjects/ScrollZone.js rename to todo/TS Source/gameobjects/ScrollZone.js diff --git a/TS Source/gameobjects/ScrollZone.ts b/todo/TS Source/gameobjects/ScrollZone.ts similarity index 100% rename from TS Source/gameobjects/ScrollZone.ts rename to todo/TS Source/gameobjects/ScrollZone.ts diff --git a/TS Source/gameobjects/Sprite.js b/todo/TS Source/gameobjects/Sprite.js similarity index 100% rename from TS Source/gameobjects/Sprite.js rename to todo/TS Source/gameobjects/Sprite.js diff --git a/TS Source/gameobjects/Sprite.ts b/todo/TS Source/gameobjects/Sprite.ts similarity index 100% rename from TS Source/gameobjects/Sprite.ts rename to todo/TS Source/gameobjects/Sprite.ts diff --git a/TS Source/gameobjects/TransformManager.js b/todo/TS Source/gameobjects/TransformManager.js similarity index 100% rename from TS Source/gameobjects/TransformManager.js rename to todo/TS Source/gameobjects/TransformManager.js diff --git a/TS Source/gameobjects/TransformManager.ts b/todo/TS Source/gameobjects/TransformManager.ts similarity index 100% rename from TS Source/gameobjects/TransformManager.ts rename to todo/TS Source/gameobjects/TransformManager.ts diff --git a/TS Source/geom/Circle.js b/todo/TS Source/geom/Circle.js similarity index 100% rename from TS Source/geom/Circle.js rename to todo/TS Source/geom/Circle.js diff --git a/TS Source/geom/Circle.ts b/todo/TS Source/geom/Circle.ts similarity index 100% rename from TS Source/geom/Circle.ts rename to todo/TS Source/geom/Circle.ts diff --git a/TS Source/geom/Line.js b/todo/TS Source/geom/Line.js similarity index 100% rename from TS Source/geom/Line.js rename to todo/TS Source/geom/Line.js diff --git a/TS Source/geom/Line.ts b/todo/TS Source/geom/Line.ts similarity index 100% rename from TS Source/geom/Line.ts rename to todo/TS Source/geom/Line.ts diff --git a/TS Source/geom/Point.js b/todo/TS Source/geom/Point.js similarity index 100% rename from TS Source/geom/Point.js rename to todo/TS Source/geom/Point.js diff --git a/TS Source/geom/Point.ts b/todo/TS Source/geom/Point.ts similarity index 100% rename from TS Source/geom/Point.ts rename to todo/TS Source/geom/Point.ts diff --git a/TS Source/geom/Rectangle.js b/todo/TS Source/geom/Rectangle.js similarity index 100% rename from TS Source/geom/Rectangle.js rename to todo/TS Source/geom/Rectangle.js diff --git a/TS Source/geom/Rectangle.ts b/todo/TS Source/geom/Rectangle.ts similarity index 100% rename from TS Source/geom/Rectangle.ts rename to todo/TS Source/geom/Rectangle.ts diff --git a/TS Source/input/InputHandler.js b/todo/TS Source/input/InputHandler.js similarity index 100% rename from TS Source/input/InputHandler.js rename to todo/TS Source/input/InputHandler.js diff --git a/TS Source/input/InputHandler.ts b/todo/TS Source/input/InputHandler.ts similarity index 100% rename from TS Source/input/InputHandler.ts rename to todo/TS Source/input/InputHandler.ts diff --git a/TS Source/input/InputManager.js b/todo/TS Source/input/InputManager.js similarity index 100% rename from TS Source/input/InputManager.js rename to todo/TS Source/input/InputManager.js diff --git a/TS Source/input/InputManager.ts b/todo/TS Source/input/InputManager.ts similarity index 100% rename from TS Source/input/InputManager.ts rename to todo/TS Source/input/InputManager.ts diff --git a/TS Source/input/Keyboard.js b/todo/TS Source/input/Keyboard.js similarity index 100% rename from TS Source/input/Keyboard.js rename to todo/TS Source/input/Keyboard.js diff --git a/TS Source/input/Keyboard.ts b/todo/TS Source/input/Keyboard.ts similarity index 100% rename from TS Source/input/Keyboard.ts rename to todo/TS Source/input/Keyboard.ts diff --git a/TS Source/input/MSPointer.js b/todo/TS Source/input/MSPointer.js similarity index 100% rename from TS Source/input/MSPointer.js rename to todo/TS Source/input/MSPointer.js diff --git a/TS Source/input/MSPointer.ts b/todo/TS Source/input/MSPointer.ts similarity index 100% rename from TS Source/input/MSPointer.ts rename to todo/TS Source/input/MSPointer.ts diff --git a/TS Source/input/Mouse.js b/todo/TS Source/input/Mouse.js similarity index 100% rename from TS Source/input/Mouse.js rename to todo/TS Source/input/Mouse.js diff --git a/TS Source/input/Mouse.ts b/todo/TS Source/input/Mouse.ts similarity index 100% rename from TS Source/input/Mouse.ts rename to todo/TS Source/input/Mouse.ts diff --git a/TS Source/input/Pointer.js b/todo/TS Source/input/Pointer.js similarity index 100% rename from TS Source/input/Pointer.js rename to todo/TS Source/input/Pointer.js diff --git a/TS Source/input/Pointer.ts b/todo/TS Source/input/Pointer.ts similarity index 100% rename from TS Source/input/Pointer.ts rename to todo/TS Source/input/Pointer.ts diff --git a/TS Source/input/Touch.js b/todo/TS Source/input/Touch.js similarity index 100% rename from TS Source/input/Touch.js rename to todo/TS Source/input/Touch.js diff --git a/TS Source/input/Touch.ts b/todo/TS Source/input/Touch.ts similarity index 100% rename from TS Source/input/Touch.ts rename to todo/TS Source/input/Touch.ts diff --git a/TS Source/loader/AnimationLoader.js b/todo/TS Source/loader/AnimationLoader.js similarity index 100% rename from TS Source/loader/AnimationLoader.js rename to todo/TS Source/loader/AnimationLoader.js diff --git a/TS Source/loader/AnimationLoader.ts b/todo/TS Source/loader/AnimationLoader.ts similarity index 100% rename from TS Source/loader/AnimationLoader.ts rename to todo/TS Source/loader/AnimationLoader.ts diff --git a/TS Source/loader/Cache.js b/todo/TS Source/loader/Cache.js similarity index 100% rename from TS Source/loader/Cache.js rename to todo/TS Source/loader/Cache.js diff --git a/TS Source/loader/Cache.ts b/todo/TS Source/loader/Cache.ts similarity index 100% rename from TS Source/loader/Cache.ts rename to todo/TS Source/loader/Cache.ts diff --git a/TS Source/loader/Loader.js b/todo/TS Source/loader/Loader.js similarity index 100% rename from TS Source/loader/Loader.js rename to todo/TS Source/loader/Loader.js diff --git a/TS Source/loader/Loader.ts b/todo/TS Source/loader/Loader.ts similarity index 100% rename from TS Source/loader/Loader.ts rename to todo/TS Source/loader/Loader.ts diff --git a/TS Source/math/GameMath.js b/todo/TS Source/math/GameMath.js similarity index 100% rename from TS Source/math/GameMath.js rename to todo/TS Source/math/GameMath.js diff --git a/TS Source/math/GameMath.ts b/todo/TS Source/math/GameMath.ts similarity index 100% rename from TS Source/math/GameMath.ts rename to todo/TS Source/math/GameMath.ts diff --git a/TS Source/math/LinkedList.js b/todo/TS Source/math/LinkedList.js similarity index 100% rename from TS Source/math/LinkedList.js rename to todo/TS Source/math/LinkedList.js diff --git a/TS Source/math/LinkedList.ts b/todo/TS Source/math/LinkedList.ts similarity index 100% rename from TS Source/math/LinkedList.ts rename to todo/TS Source/math/LinkedList.ts diff --git a/TS Source/math/Mat3.js b/todo/TS Source/math/Mat3.js similarity index 100% rename from TS Source/math/Mat3.js rename to todo/TS Source/math/Mat3.js diff --git a/TS Source/math/Mat3.ts b/todo/TS Source/math/Mat3.ts similarity index 100% rename from TS Source/math/Mat3.ts rename to todo/TS Source/math/Mat3.ts diff --git a/TS Source/math/Mat3Utils.js b/todo/TS Source/math/Mat3Utils.js similarity index 100% rename from TS Source/math/Mat3Utils.js rename to todo/TS Source/math/Mat3Utils.js diff --git a/TS Source/math/Mat3Utils.ts b/todo/TS Source/math/Mat3Utils.ts similarity index 100% rename from TS Source/math/Mat3Utils.ts rename to todo/TS Source/math/Mat3Utils.ts diff --git a/TS Source/math/QuadTree.js b/todo/TS Source/math/QuadTree.js similarity index 100% rename from TS Source/math/QuadTree.js rename to todo/TS Source/math/QuadTree.js diff --git a/TS Source/math/QuadTree.ts b/todo/TS Source/math/QuadTree.ts similarity index 100% rename from TS Source/math/QuadTree.ts rename to todo/TS Source/math/QuadTree.ts diff --git a/TS Source/math/RandomDataGenerator.js b/todo/TS Source/math/RandomDataGenerator.js similarity index 100% rename from TS Source/math/RandomDataGenerator.js rename to todo/TS Source/math/RandomDataGenerator.js diff --git a/TS Source/math/RandomDataGenerator.ts b/todo/TS Source/math/RandomDataGenerator.ts similarity index 100% rename from TS Source/math/RandomDataGenerator.ts rename to todo/TS Source/math/RandomDataGenerator.ts diff --git a/TS Source/math/Vec2.js b/todo/TS Source/math/Vec2.js similarity index 100% rename from TS Source/math/Vec2.js rename to todo/TS Source/math/Vec2.js diff --git a/TS Source/math/Vec2.ts b/todo/TS Source/math/Vec2.ts similarity index 100% rename from TS Source/math/Vec2.ts rename to todo/TS Source/math/Vec2.ts diff --git a/TS Source/math/Vec2Utils.js b/todo/TS Source/math/Vec2Utils.js similarity index 100% rename from TS Source/math/Vec2Utils.js rename to todo/TS Source/math/Vec2Utils.js diff --git a/TS Source/math/Vec2Utils.ts b/todo/TS Source/math/Vec2Utils.ts similarity index 100% rename from TS Source/math/Vec2Utils.ts rename to todo/TS Source/math/Vec2Utils.ts diff --git a/TS Source/net/Net.js b/todo/TS Source/net/Net.js similarity index 100% rename from TS Source/net/Net.js rename to todo/TS Source/net/Net.js diff --git a/TS Source/net/Net.ts b/todo/TS Source/net/Net.ts similarity index 100% rename from TS Source/net/Net.ts rename to todo/TS Source/net/Net.ts diff --git a/TS Source/particles/Emitter.js b/todo/TS Source/particles/Emitter.js similarity index 100% rename from TS Source/particles/Emitter.js rename to todo/TS Source/particles/Emitter.js diff --git a/TS Source/particles/Emitter.ts b/todo/TS Source/particles/Emitter.ts similarity index 100% rename from TS Source/particles/Emitter.ts rename to todo/TS Source/particles/Emitter.ts diff --git a/TS Source/particles/NumericalIntegration.js b/todo/TS Source/particles/NumericalIntegration.js similarity index 100% rename from TS Source/particles/NumericalIntegration.js rename to todo/TS Source/particles/NumericalIntegration.js diff --git a/TS Source/particles/NumericalIntegration.ts b/todo/TS Source/particles/NumericalIntegration.ts similarity index 100% rename from TS Source/particles/NumericalIntegration.ts rename to todo/TS Source/particles/NumericalIntegration.ts diff --git a/TS Source/particles/Particle.js b/todo/TS Source/particles/Particle.js similarity index 100% rename from TS Source/particles/Particle.js rename to todo/TS Source/particles/Particle.js diff --git a/TS Source/particles/Particle.ts b/todo/TS Source/particles/Particle.ts similarity index 100% rename from TS Source/particles/Particle.ts rename to todo/TS Source/particles/Particle.ts diff --git a/TS Source/particles/ParticleManager.js b/todo/TS Source/particles/ParticleManager.js similarity index 100% rename from TS Source/particles/ParticleManager.js rename to todo/TS Source/particles/ParticleManager.js diff --git a/TS Source/particles/ParticleManager.ts b/todo/TS Source/particles/ParticleManager.ts similarity index 100% rename from TS Source/particles/ParticleManager.ts rename to todo/TS Source/particles/ParticleManager.ts diff --git a/TS Source/particles/ParticlePool.js b/todo/TS Source/particles/ParticlePool.js similarity index 100% rename from TS Source/particles/ParticlePool.js rename to todo/TS Source/particles/ParticlePool.js diff --git a/TS Source/particles/ParticlePool.ts b/todo/TS Source/particles/ParticlePool.ts similarity index 100% rename from TS Source/particles/ParticlePool.ts rename to todo/TS Source/particles/ParticlePool.ts diff --git a/TS Source/particles/ParticleUtils.js b/todo/TS Source/particles/ParticleUtils.js similarity index 100% rename from TS Source/particles/ParticleUtils.js rename to todo/TS Source/particles/ParticleUtils.js diff --git a/TS Source/particles/ParticleUtils.ts b/todo/TS Source/particles/ParticleUtils.ts similarity index 100% rename from TS Source/particles/ParticleUtils.ts rename to todo/TS Source/particles/ParticleUtils.ts diff --git a/TS Source/particles/Polar2D.js b/todo/TS Source/particles/Polar2D.js similarity index 100% rename from TS Source/particles/Polar2D.js rename to todo/TS Source/particles/Polar2D.js diff --git a/TS Source/particles/Polar2D.ts b/todo/TS Source/particles/Polar2D.ts similarity index 100% rename from TS Source/particles/Polar2D.ts rename to todo/TS Source/particles/Polar2D.ts diff --git a/TS Source/particles/Span.js b/todo/TS Source/particles/Span.js similarity index 100% rename from TS Source/particles/Span.js rename to todo/TS Source/particles/Span.js diff --git a/TS Source/particles/Span.ts b/todo/TS Source/particles/Span.ts similarity index 100% rename from TS Source/particles/Span.ts rename to todo/TS Source/particles/Span.ts diff --git a/TS Source/particles/behaviours/Behaviour.js b/todo/TS Source/particles/behaviours/Behaviour.js similarity index 100% rename from TS Source/particles/behaviours/Behaviour.js rename to todo/TS Source/particles/behaviours/Behaviour.js diff --git a/TS Source/particles/behaviours/Behaviour.ts b/todo/TS Source/particles/behaviours/Behaviour.ts similarity index 100% rename from TS Source/particles/behaviours/Behaviour.ts rename to todo/TS Source/particles/behaviours/Behaviour.ts diff --git a/TS Source/particles/behaviours/RandomDrift.js b/todo/TS Source/particles/behaviours/RandomDrift.js similarity index 100% rename from TS Source/particles/behaviours/RandomDrift.js rename to todo/TS Source/particles/behaviours/RandomDrift.js diff --git a/TS Source/particles/behaviours/RandomDrift.ts b/todo/TS Source/particles/behaviours/RandomDrift.ts similarity index 100% rename from TS Source/particles/behaviours/RandomDrift.ts rename to todo/TS Source/particles/behaviours/RandomDrift.ts diff --git a/TS Source/particles/initialize/Initialize.js b/todo/TS Source/particles/initialize/Initialize.js similarity index 100% rename from TS Source/particles/initialize/Initialize.js rename to todo/TS Source/particles/initialize/Initialize.js diff --git a/TS Source/particles/initialize/Initialize.ts b/todo/TS Source/particles/initialize/Initialize.ts similarity index 100% rename from TS Source/particles/initialize/Initialize.ts rename to todo/TS Source/particles/initialize/Initialize.ts diff --git a/TS Source/particles/initialize/Life.js b/todo/TS Source/particles/initialize/Life.js similarity index 100% rename from TS Source/particles/initialize/Life.js rename to todo/TS Source/particles/initialize/Life.js diff --git a/TS Source/particles/initialize/Life.ts b/todo/TS Source/particles/initialize/Life.ts similarity index 100% rename from TS Source/particles/initialize/Life.ts rename to todo/TS Source/particles/initialize/Life.ts diff --git a/TS Source/particles/initialize/Mass.js b/todo/TS Source/particles/initialize/Mass.js similarity index 100% rename from TS Source/particles/initialize/Mass.js rename to todo/TS Source/particles/initialize/Mass.js diff --git a/TS Source/particles/initialize/Mass.ts b/todo/TS Source/particles/initialize/Mass.ts similarity index 100% rename from TS Source/particles/initialize/Mass.ts rename to todo/TS Source/particles/initialize/Mass.ts diff --git a/TS Source/particles/initialize/Position.js b/todo/TS Source/particles/initialize/Position.js similarity index 100% rename from TS Source/particles/initialize/Position.js rename to todo/TS Source/particles/initialize/Position.js diff --git a/TS Source/particles/initialize/Position.ts b/todo/TS Source/particles/initialize/Position.ts similarity index 100% rename from TS Source/particles/initialize/Position.ts rename to todo/TS Source/particles/initialize/Position.ts diff --git a/TS Source/particles/initialize/Radius.ts b/todo/TS Source/particles/initialize/Radius.ts similarity index 100% rename from TS Source/particles/initialize/Radius.ts rename to todo/TS Source/particles/initialize/Radius.ts diff --git a/TS Source/particles/initialize/Rate.js b/todo/TS Source/particles/initialize/Rate.js similarity index 100% rename from TS Source/particles/initialize/Rate.js rename to todo/TS Source/particles/initialize/Rate.js diff --git a/TS Source/particles/initialize/Rate.ts b/todo/TS Source/particles/initialize/Rate.ts similarity index 100% rename from TS Source/particles/initialize/Rate.ts rename to todo/TS Source/particles/initialize/Rate.ts diff --git a/TS Source/particles/initialize/Velocity.js b/todo/TS Source/particles/initialize/Velocity.js similarity index 100% rename from TS Source/particles/initialize/Velocity.js rename to todo/TS Source/particles/initialize/Velocity.js diff --git a/TS Source/particles/initialize/Velocity.ts b/todo/TS Source/particles/initialize/Velocity.ts similarity index 100% rename from TS Source/particles/initialize/Velocity.ts rename to todo/TS Source/particles/initialize/Velocity.ts diff --git a/TS Source/particles/zone/PointZone.js b/todo/TS Source/particles/zone/PointZone.js similarity index 100% rename from TS Source/particles/zone/PointZone.js rename to todo/TS Source/particles/zone/PointZone.js diff --git a/TS Source/particles/zone/PointZone.ts b/todo/TS Source/particles/zone/PointZone.ts similarity index 100% rename from TS Source/particles/zone/PointZone.ts rename to todo/TS Source/particles/zone/PointZone.ts diff --git a/TS Source/particles/zone/Zone.js b/todo/TS Source/particles/zone/Zone.js similarity index 100% rename from TS Source/particles/zone/Zone.js rename to todo/TS Source/particles/zone/Zone.js diff --git a/TS Source/particles/zone/Zone.ts b/todo/TS Source/particles/zone/Zone.ts similarity index 100% rename from TS Source/particles/zone/Zone.ts rename to todo/TS Source/particles/zone/Zone.ts diff --git a/TS Source/physics/AABB.js b/todo/TS Source/physics/AABB.js similarity index 100% rename from TS Source/physics/AABB.js rename to todo/TS Source/physics/AABB.js diff --git a/TS Source/physics/AABB.ts b/todo/TS Source/physics/AABB.ts similarity index 100% rename from TS Source/physics/AABB.ts rename to todo/TS Source/physics/AABB.ts diff --git a/TS Source/physics/Body.js b/todo/TS Source/physics/Body.js similarity index 100% rename from TS Source/physics/Body.js rename to todo/TS Source/physics/Body.js diff --git a/TS Source/physics/Body.ts b/todo/TS Source/physics/Body.ts similarity index 100% rename from TS Source/physics/Body.ts rename to todo/TS Source/physics/Body.ts diff --git a/TS Source/physics/Circle.js b/todo/TS Source/physics/Circle.js similarity index 100% rename from TS Source/physics/Circle.js rename to todo/TS Source/physics/Circle.js diff --git a/TS Source/physics/Circle.ts b/todo/TS Source/physics/Circle.ts similarity index 100% rename from TS Source/physics/Circle.ts rename to todo/TS Source/physics/Circle.ts diff --git a/TS Source/physics/PhysicsManager.js b/todo/TS Source/physics/PhysicsManager.js similarity index 100% rename from TS Source/physics/PhysicsManager.js rename to todo/TS Source/physics/PhysicsManager.js diff --git a/TS Source/physics/PhysicsManager.ts b/todo/TS Source/physics/PhysicsManager.ts similarity index 100% rename from TS Source/physics/PhysicsManager.ts rename to todo/TS Source/physics/PhysicsManager.ts diff --git a/TS Source/physics/TileMapCell.js b/todo/TS Source/physics/TileMapCell.js similarity index 100% rename from TS Source/physics/TileMapCell.js rename to todo/TS Source/physics/TileMapCell.js diff --git a/TS Source/physics/TileMapCell.ts b/todo/TS Source/physics/TileMapCell.ts similarity index 100% rename from TS Source/physics/TileMapCell.ts rename to todo/TS Source/physics/TileMapCell.ts diff --git a/TS Source/physics/aabb/ProjAABB22Deg.js b/todo/TS Source/physics/aabb/ProjAABB22Deg.js similarity index 100% rename from TS Source/physics/aabb/ProjAABB22Deg.js rename to todo/TS Source/physics/aabb/ProjAABB22Deg.js diff --git a/TS Source/physics/aabb/ProjAABB22Deg.ts b/todo/TS Source/physics/aabb/ProjAABB22Deg.ts similarity index 100% rename from TS Source/physics/aabb/ProjAABB22Deg.ts rename to todo/TS Source/physics/aabb/ProjAABB22Deg.ts diff --git a/TS Source/physics/aabb/ProjAABB45Deg.js b/todo/TS Source/physics/aabb/ProjAABB45Deg.js similarity index 100% rename from TS Source/physics/aabb/ProjAABB45Deg.js rename to todo/TS Source/physics/aabb/ProjAABB45Deg.js diff --git a/TS Source/physics/aabb/ProjAABB45Deg.ts b/todo/TS Source/physics/aabb/ProjAABB45Deg.ts similarity index 100% rename from TS Source/physics/aabb/ProjAABB45Deg.ts rename to todo/TS Source/physics/aabb/ProjAABB45Deg.ts diff --git a/TS Source/physics/aabb/ProjAABB67Deg.js b/todo/TS Source/physics/aabb/ProjAABB67Deg.js similarity index 100% rename from TS Source/physics/aabb/ProjAABB67Deg.js rename to todo/TS Source/physics/aabb/ProjAABB67Deg.js diff --git a/TS Source/physics/aabb/ProjAABB67Deg.ts b/todo/TS Source/physics/aabb/ProjAABB67Deg.ts similarity index 100% rename from TS Source/physics/aabb/ProjAABB67Deg.ts rename to todo/TS Source/physics/aabb/ProjAABB67Deg.ts diff --git a/TS Source/physics/aabb/ProjAABBConcave.js b/todo/TS Source/physics/aabb/ProjAABBConcave.js similarity index 100% rename from TS Source/physics/aabb/ProjAABBConcave.js rename to todo/TS Source/physics/aabb/ProjAABBConcave.js diff --git a/TS Source/physics/aabb/ProjAABBConcave.ts b/todo/TS Source/physics/aabb/ProjAABBConcave.ts similarity index 100% rename from TS Source/physics/aabb/ProjAABBConcave.ts rename to todo/TS Source/physics/aabb/ProjAABBConcave.ts diff --git a/TS Source/physics/aabb/ProjAABBConvex.js b/todo/TS Source/physics/aabb/ProjAABBConvex.js similarity index 100% rename from TS Source/physics/aabb/ProjAABBConvex.js rename to todo/TS Source/physics/aabb/ProjAABBConvex.js diff --git a/TS Source/physics/aabb/ProjAABBConvex.ts b/todo/TS Source/physics/aabb/ProjAABBConvex.ts similarity index 100% rename from TS Source/physics/aabb/ProjAABBConvex.ts rename to todo/TS Source/physics/aabb/ProjAABBConvex.ts diff --git a/TS Source/physics/aabb/ProjAABBFull.js b/todo/TS Source/physics/aabb/ProjAABBFull.js similarity index 100% rename from TS Source/physics/aabb/ProjAABBFull.js rename to todo/TS Source/physics/aabb/ProjAABBFull.js diff --git a/TS Source/physics/aabb/ProjAABBFull.ts b/todo/TS Source/physics/aabb/ProjAABBFull.ts similarity index 100% rename from TS Source/physics/aabb/ProjAABBFull.ts rename to todo/TS Source/physics/aabb/ProjAABBFull.ts diff --git a/TS Source/physics/aabb/ProjAABBHalf.js b/todo/TS Source/physics/aabb/ProjAABBHalf.js similarity index 100% rename from TS Source/physics/aabb/ProjAABBHalf.js rename to todo/TS Source/physics/aabb/ProjAABBHalf.js diff --git a/TS Source/physics/aabb/ProjAABBHalf.ts b/todo/TS Source/physics/aabb/ProjAABBHalf.ts similarity index 100% rename from TS Source/physics/aabb/ProjAABBHalf.ts rename to todo/TS Source/physics/aabb/ProjAABBHalf.ts diff --git a/TS Source/physics/circle/ProjCircle22Deg.js b/todo/TS Source/physics/circle/ProjCircle22Deg.js similarity index 100% rename from TS Source/physics/circle/ProjCircle22Deg.js rename to todo/TS Source/physics/circle/ProjCircle22Deg.js diff --git a/TS Source/physics/circle/ProjCircle22Deg.ts b/todo/TS Source/physics/circle/ProjCircle22Deg.ts similarity index 100% rename from TS Source/physics/circle/ProjCircle22Deg.ts rename to todo/TS Source/physics/circle/ProjCircle22Deg.ts diff --git a/TS Source/physics/circle/ProjCircle45Deg.js b/todo/TS Source/physics/circle/ProjCircle45Deg.js similarity index 100% rename from TS Source/physics/circle/ProjCircle45Deg.js rename to todo/TS Source/physics/circle/ProjCircle45Deg.js diff --git a/TS Source/physics/circle/ProjCircle45Deg.ts b/todo/TS Source/physics/circle/ProjCircle45Deg.ts similarity index 100% rename from TS Source/physics/circle/ProjCircle45Deg.ts rename to todo/TS Source/physics/circle/ProjCircle45Deg.ts diff --git a/TS Source/physics/circle/ProjCircle67Deg.js b/todo/TS Source/physics/circle/ProjCircle67Deg.js similarity index 100% rename from TS Source/physics/circle/ProjCircle67Deg.js rename to todo/TS Source/physics/circle/ProjCircle67Deg.js diff --git a/TS Source/physics/circle/ProjCircle67Deg.ts b/todo/TS Source/physics/circle/ProjCircle67Deg.ts similarity index 100% rename from TS Source/physics/circle/ProjCircle67Deg.ts rename to todo/TS Source/physics/circle/ProjCircle67Deg.ts diff --git a/TS Source/physics/circle/ProjCircleConcave.js b/todo/TS Source/physics/circle/ProjCircleConcave.js similarity index 100% rename from TS Source/physics/circle/ProjCircleConcave.js rename to todo/TS Source/physics/circle/ProjCircleConcave.js diff --git a/TS Source/physics/circle/ProjCircleConcave.ts b/todo/TS Source/physics/circle/ProjCircleConcave.ts similarity index 100% rename from TS Source/physics/circle/ProjCircleConcave.ts rename to todo/TS Source/physics/circle/ProjCircleConcave.ts diff --git a/TS Source/physics/circle/ProjCircleConvex.js b/todo/TS Source/physics/circle/ProjCircleConvex.js similarity index 100% rename from TS Source/physics/circle/ProjCircleConvex.js rename to todo/TS Source/physics/circle/ProjCircleConvex.js diff --git a/TS Source/physics/circle/ProjCircleConvex.ts b/todo/TS Source/physics/circle/ProjCircleConvex.ts similarity index 100% rename from TS Source/physics/circle/ProjCircleConvex.ts rename to todo/TS Source/physics/circle/ProjCircleConvex.ts diff --git a/TS Source/physics/circle/ProjCircleFull.js b/todo/TS Source/physics/circle/ProjCircleFull.js similarity index 100% rename from TS Source/physics/circle/ProjCircleFull.js rename to todo/TS Source/physics/circle/ProjCircleFull.js diff --git a/TS Source/physics/circle/ProjCircleFull.ts b/todo/TS Source/physics/circle/ProjCircleFull.ts similarity index 100% rename from TS Source/physics/circle/ProjCircleFull.ts rename to todo/TS Source/physics/circle/ProjCircleFull.ts diff --git a/TS Source/physics/circle/ProjCircleHalf.js b/todo/TS Source/physics/circle/ProjCircleHalf.js similarity index 100% rename from TS Source/physics/circle/ProjCircleHalf.js rename to todo/TS Source/physics/circle/ProjCircleHalf.js diff --git a/TS Source/physics/circle/ProjCircleHalf.ts b/todo/TS Source/physics/circle/ProjCircleHalf.ts similarity index 100% rename from TS Source/physics/circle/ProjCircleHalf.ts rename to todo/TS Source/physics/circle/ProjCircleHalf.ts diff --git a/TS Source/renderers/HeadlessRenderer.js b/todo/TS Source/renderers/HeadlessRenderer.js similarity index 100% rename from TS Source/renderers/HeadlessRenderer.js rename to todo/TS Source/renderers/HeadlessRenderer.js diff --git a/TS Source/renderers/HeadlessRenderer.ts b/todo/TS Source/renderers/HeadlessRenderer.ts similarity index 100% rename from TS Source/renderers/HeadlessRenderer.ts rename to todo/TS Source/renderers/HeadlessRenderer.ts diff --git a/TS Source/renderers/IRenderer.ts b/todo/TS Source/renderers/IRenderer.ts similarity index 100% rename from TS Source/renderers/IRenderer.ts rename to todo/TS Source/renderers/IRenderer.ts diff --git a/TS Source/renderers/canvas/CameraRenderer.js b/todo/TS Source/renderers/canvas/CameraRenderer.js similarity index 100% rename from TS Source/renderers/canvas/CameraRenderer.js rename to todo/TS Source/renderers/canvas/CameraRenderer.js diff --git a/TS Source/renderers/canvas/CameraRenderer.ts b/todo/TS Source/renderers/canvas/CameraRenderer.ts similarity index 100% rename from TS Source/renderers/canvas/CameraRenderer.ts rename to todo/TS Source/renderers/canvas/CameraRenderer.ts diff --git a/TS Source/renderers/canvas/CanvasRenderer.js b/todo/TS Source/renderers/canvas/CanvasRenderer.js similarity index 100% rename from TS Source/renderers/canvas/CanvasRenderer.js rename to todo/TS Source/renderers/canvas/CanvasRenderer.js diff --git a/TS Source/renderers/canvas/CanvasRenderer.ts b/todo/TS Source/renderers/canvas/CanvasRenderer.ts similarity index 100% rename from TS Source/renderers/canvas/CanvasRenderer.ts rename to todo/TS Source/renderers/canvas/CanvasRenderer.ts diff --git a/TS Source/renderers/canvas/GeometryRenderer.js b/todo/TS Source/renderers/canvas/GeometryRenderer.js similarity index 100% rename from TS Source/renderers/canvas/GeometryRenderer.js rename to todo/TS Source/renderers/canvas/GeometryRenderer.js diff --git a/TS Source/renderers/canvas/GeometryRenderer.ts b/todo/TS Source/renderers/canvas/GeometryRenderer.ts similarity index 100% rename from TS Source/renderers/canvas/GeometryRenderer.ts rename to todo/TS Source/renderers/canvas/GeometryRenderer.ts diff --git a/TS Source/renderers/canvas/GroupRenderer.js b/todo/TS Source/renderers/canvas/GroupRenderer.js similarity index 100% rename from TS Source/renderers/canvas/GroupRenderer.js rename to todo/TS Source/renderers/canvas/GroupRenderer.js diff --git a/TS Source/renderers/canvas/GroupRenderer.ts b/todo/TS Source/renderers/canvas/GroupRenderer.ts similarity index 100% rename from TS Source/renderers/canvas/GroupRenderer.ts rename to todo/TS Source/renderers/canvas/GroupRenderer.ts diff --git a/TS Source/renderers/canvas/ScrollZoneRenderer.js b/todo/TS Source/renderers/canvas/ScrollZoneRenderer.js similarity index 100% rename from TS Source/renderers/canvas/ScrollZoneRenderer.js rename to todo/TS Source/renderers/canvas/ScrollZoneRenderer.js diff --git a/TS Source/renderers/canvas/ScrollZoneRenderer.ts b/todo/TS Source/renderers/canvas/ScrollZoneRenderer.ts similarity index 100% rename from TS Source/renderers/canvas/ScrollZoneRenderer.ts rename to todo/TS Source/renderers/canvas/ScrollZoneRenderer.ts diff --git a/TS Source/renderers/canvas/SpriteRenderer.js b/todo/TS Source/renderers/canvas/SpriteRenderer.js similarity index 100% rename from TS Source/renderers/canvas/SpriteRenderer.js rename to todo/TS Source/renderers/canvas/SpriteRenderer.js diff --git a/TS Source/renderers/canvas/SpriteRenderer.ts b/todo/TS Source/renderers/canvas/SpriteRenderer.ts similarity index 100% rename from TS Source/renderers/canvas/SpriteRenderer.ts rename to todo/TS Source/renderers/canvas/SpriteRenderer.ts diff --git a/TS Source/renderers/canvas/TilemapRenderer.js b/todo/TS Source/renderers/canvas/TilemapRenderer.js similarity index 100% rename from TS Source/renderers/canvas/TilemapRenderer.js rename to todo/TS Source/renderers/canvas/TilemapRenderer.js diff --git a/TS Source/renderers/canvas/TilemapRenderer.ts b/todo/TS Source/renderers/canvas/TilemapRenderer.ts similarity index 100% rename from TS Source/renderers/canvas/TilemapRenderer.ts rename to todo/TS Source/renderers/canvas/TilemapRenderer.ts diff --git a/TS Source/sound/Sound.js b/todo/TS Source/sound/Sound.js similarity index 100% rename from TS Source/sound/Sound.js rename to todo/TS Source/sound/Sound.js diff --git a/TS Source/sound/Sound.ts b/todo/TS Source/sound/Sound.ts similarity index 100% rename from TS Source/sound/Sound.ts rename to todo/TS Source/sound/Sound.ts diff --git a/TS Source/sound/SoundManager.js b/todo/TS Source/sound/SoundManager.js similarity index 100% rename from TS Source/sound/SoundManager.js rename to todo/TS Source/sound/SoundManager.js diff --git a/TS Source/sound/SoundManager.ts b/todo/TS Source/sound/SoundManager.ts similarity index 100% rename from TS Source/sound/SoundManager.ts rename to todo/TS Source/sound/SoundManager.ts diff --git a/TS Source/system/Device.js b/todo/TS Source/system/Device.js similarity index 100% rename from TS Source/system/Device.js rename to todo/TS Source/system/Device.js diff --git a/TS Source/system/Device.ts b/todo/TS Source/system/Device.ts similarity index 100% rename from TS Source/system/Device.ts rename to todo/TS Source/system/Device.ts diff --git a/TS Source/system/RequestAnimationFrame.js b/todo/TS Source/system/RequestAnimationFrame.js similarity index 100% rename from TS Source/system/RequestAnimationFrame.js rename to todo/TS Source/system/RequestAnimationFrame.js diff --git a/TS Source/system/RequestAnimationFrame.ts b/todo/TS Source/system/RequestAnimationFrame.ts similarity index 100% rename from TS Source/system/RequestAnimationFrame.ts rename to todo/TS Source/system/RequestAnimationFrame.ts diff --git a/TS Source/system/StageScaleMode.js b/todo/TS Source/system/StageScaleMode.js similarity index 100% rename from TS Source/system/StageScaleMode.js rename to todo/TS Source/system/StageScaleMode.js diff --git a/TS Source/system/StageScaleMode.ts b/todo/TS Source/system/StageScaleMode.ts similarity index 100% rename from TS Source/system/StageScaleMode.ts rename to todo/TS Source/system/StageScaleMode.ts diff --git a/TS Source/system/screens/BootScreen.js b/todo/TS Source/system/screens/BootScreen.js similarity index 100% rename from TS Source/system/screens/BootScreen.js rename to todo/TS Source/system/screens/BootScreen.js diff --git a/TS Source/system/screens/BootScreen.ts b/todo/TS Source/system/screens/BootScreen.ts similarity index 100% rename from TS Source/system/screens/BootScreen.ts rename to todo/TS Source/system/screens/BootScreen.ts diff --git a/TS Source/system/screens/OrientationScreen.js b/todo/TS Source/system/screens/OrientationScreen.js similarity index 100% rename from TS Source/system/screens/OrientationScreen.js rename to todo/TS Source/system/screens/OrientationScreen.js diff --git a/TS Source/system/screens/OrientationScreen.ts b/todo/TS Source/system/screens/OrientationScreen.ts similarity index 100% rename from TS Source/system/screens/OrientationScreen.ts rename to todo/TS Source/system/screens/OrientationScreen.ts diff --git a/TS Source/system/screens/PauseScreen.js b/todo/TS Source/system/screens/PauseScreen.js similarity index 100% rename from TS Source/system/screens/PauseScreen.js rename to todo/TS Source/system/screens/PauseScreen.js diff --git a/TS Source/system/screens/PauseScreen.ts b/todo/TS Source/system/screens/PauseScreen.ts similarity index 100% rename from TS Source/system/screens/PauseScreen.ts rename to todo/TS Source/system/screens/PauseScreen.ts diff --git a/TS Source/tilemap/Tile.js b/todo/TS Source/tilemap/Tile.js similarity index 100% rename from TS Source/tilemap/Tile.js rename to todo/TS Source/tilemap/Tile.js diff --git a/TS Source/tilemap/Tile.ts b/todo/TS Source/tilemap/Tile.ts similarity index 100% rename from TS Source/tilemap/Tile.ts rename to todo/TS Source/tilemap/Tile.ts diff --git a/TS Source/tilemap/Tilemap.js b/todo/TS Source/tilemap/Tilemap.js similarity index 100% rename from TS Source/tilemap/Tilemap.js rename to todo/TS Source/tilemap/Tilemap.js diff --git a/TS Source/tilemap/Tilemap.ts b/todo/TS Source/tilemap/Tilemap.ts similarity index 100% rename from TS Source/tilemap/Tilemap.ts rename to todo/TS Source/tilemap/Tilemap.ts diff --git a/TS Source/tilemap/TilemapLayer.js b/todo/TS Source/tilemap/TilemapLayer.js similarity index 100% rename from TS Source/tilemap/TilemapLayer.js rename to todo/TS Source/tilemap/TilemapLayer.js diff --git a/TS Source/tilemap/TilemapLayer.ts b/todo/TS Source/tilemap/TilemapLayer.ts similarity index 100% rename from TS Source/tilemap/TilemapLayer.ts rename to todo/TS Source/tilemap/TilemapLayer.ts diff --git a/TS Source/time/TimeManager.js b/todo/TS Source/time/TimeManager.js similarity index 100% rename from TS Source/time/TimeManager.js rename to todo/TS Source/time/TimeManager.js diff --git a/TS Source/time/TimeManager.ts b/todo/TS Source/time/TimeManager.ts similarity index 100% rename from TS Source/time/TimeManager.ts rename to todo/TS Source/time/TimeManager.ts diff --git a/TS Source/tweens/Tween.js b/todo/TS Source/tweens/Tween.js similarity index 100% rename from TS Source/tweens/Tween.js rename to todo/TS Source/tweens/Tween.js diff --git a/TS Source/tweens/Tween.ts b/todo/TS Source/tweens/Tween.ts similarity index 100% rename from TS Source/tweens/Tween.ts rename to todo/TS Source/tweens/Tween.ts diff --git a/TS Source/tweens/TweenManager.js b/todo/TS Source/tweens/TweenManager.js similarity index 100% rename from TS Source/tweens/TweenManager.js rename to todo/TS Source/tweens/TweenManager.js diff --git a/TS Source/tweens/TweenManager.ts b/todo/TS Source/tweens/TweenManager.ts similarity index 100% rename from TS Source/tweens/TweenManager.ts rename to todo/TS Source/tweens/TweenManager.ts diff --git a/TS Source/tweens/easing/Back.js b/todo/TS Source/tweens/easing/Back.js similarity index 100% rename from TS Source/tweens/easing/Back.js rename to todo/TS Source/tweens/easing/Back.js diff --git a/TS Source/tweens/easing/Back.ts b/todo/TS Source/tweens/easing/Back.ts similarity index 100% rename from TS Source/tweens/easing/Back.ts rename to todo/TS Source/tweens/easing/Back.ts diff --git a/TS Source/tweens/easing/Bounce.js b/todo/TS Source/tweens/easing/Bounce.js similarity index 100% rename from TS Source/tweens/easing/Bounce.js rename to todo/TS Source/tweens/easing/Bounce.js diff --git a/TS Source/tweens/easing/Bounce.ts b/todo/TS Source/tweens/easing/Bounce.ts similarity index 100% rename from TS Source/tweens/easing/Bounce.ts rename to todo/TS Source/tweens/easing/Bounce.ts diff --git a/TS Source/tweens/easing/Circular.js b/todo/TS Source/tweens/easing/Circular.js similarity index 100% rename from TS Source/tweens/easing/Circular.js rename to todo/TS Source/tweens/easing/Circular.js diff --git a/TS Source/tweens/easing/Circular.ts b/todo/TS Source/tweens/easing/Circular.ts similarity index 100% rename from TS Source/tweens/easing/Circular.ts rename to todo/TS Source/tweens/easing/Circular.ts diff --git a/TS Source/tweens/easing/Cubic.js b/todo/TS Source/tweens/easing/Cubic.js similarity index 100% rename from TS Source/tweens/easing/Cubic.js rename to todo/TS Source/tweens/easing/Cubic.js diff --git a/TS Source/tweens/easing/Cubic.ts b/todo/TS Source/tweens/easing/Cubic.ts similarity index 100% rename from TS Source/tweens/easing/Cubic.ts rename to todo/TS Source/tweens/easing/Cubic.ts diff --git a/TS Source/tweens/easing/Elastic.js b/todo/TS Source/tweens/easing/Elastic.js similarity index 100% rename from TS Source/tweens/easing/Elastic.js rename to todo/TS Source/tweens/easing/Elastic.js diff --git a/TS Source/tweens/easing/Elastic.ts b/todo/TS Source/tweens/easing/Elastic.ts similarity index 100% rename from TS Source/tweens/easing/Elastic.ts rename to todo/TS Source/tweens/easing/Elastic.ts diff --git a/TS Source/tweens/easing/Exponential.js b/todo/TS Source/tweens/easing/Exponential.js similarity index 100% rename from TS Source/tweens/easing/Exponential.js rename to todo/TS Source/tweens/easing/Exponential.js diff --git a/TS Source/tweens/easing/Exponential.ts b/todo/TS Source/tweens/easing/Exponential.ts similarity index 100% rename from TS Source/tweens/easing/Exponential.ts rename to todo/TS Source/tweens/easing/Exponential.ts diff --git a/TS Source/tweens/easing/Linear.js b/todo/TS Source/tweens/easing/Linear.js similarity index 100% rename from TS Source/tweens/easing/Linear.js rename to todo/TS Source/tweens/easing/Linear.js diff --git a/TS Source/tweens/easing/Linear.ts b/todo/TS Source/tweens/easing/Linear.ts similarity index 100% rename from TS Source/tweens/easing/Linear.ts rename to todo/TS Source/tweens/easing/Linear.ts diff --git a/TS Source/tweens/easing/Quadratic.js b/todo/TS Source/tweens/easing/Quadratic.js similarity index 100% rename from TS Source/tweens/easing/Quadratic.js rename to todo/TS Source/tweens/easing/Quadratic.js diff --git a/TS Source/tweens/easing/Quadratic.ts b/todo/TS Source/tweens/easing/Quadratic.ts similarity index 100% rename from TS Source/tweens/easing/Quadratic.ts rename to todo/TS Source/tweens/easing/Quadratic.ts diff --git a/TS Source/tweens/easing/Quartic.js b/todo/TS Source/tweens/easing/Quartic.js similarity index 100% rename from TS Source/tweens/easing/Quartic.js rename to todo/TS Source/tweens/easing/Quartic.js diff --git a/TS Source/tweens/easing/Quartic.ts b/todo/TS Source/tweens/easing/Quartic.ts similarity index 100% rename from TS Source/tweens/easing/Quartic.ts rename to todo/TS Source/tweens/easing/Quartic.ts diff --git a/TS Source/tweens/easing/Quintic.js b/todo/TS Source/tweens/easing/Quintic.js similarity index 100% rename from TS Source/tweens/easing/Quintic.js rename to todo/TS Source/tweens/easing/Quintic.js diff --git a/TS Source/tweens/easing/Quintic.ts b/todo/TS Source/tweens/easing/Quintic.ts similarity index 100% rename from TS Source/tweens/easing/Quintic.ts rename to todo/TS Source/tweens/easing/Quintic.ts diff --git a/TS Source/tweens/easing/Sinusoidal.js b/todo/TS Source/tweens/easing/Sinusoidal.js similarity index 100% rename from TS Source/tweens/easing/Sinusoidal.js rename to todo/TS Source/tweens/easing/Sinusoidal.js diff --git a/TS Source/tweens/easing/Sinusoidal.ts b/todo/TS Source/tweens/easing/Sinusoidal.ts similarity index 100% rename from TS Source/tweens/easing/Sinusoidal.ts rename to todo/TS Source/tweens/easing/Sinusoidal.ts diff --git a/TS Source/ui/Button.js b/todo/TS Source/ui/Button.js similarity index 100% rename from TS Source/ui/Button.js rename to todo/TS Source/ui/Button.js diff --git a/TS Source/ui/Button.ts b/todo/TS Source/ui/Button.ts similarity index 100% rename from TS Source/ui/Button.ts rename to todo/TS Source/ui/Button.ts diff --git a/TS Source/utils/CanvasUtils.js b/todo/TS Source/utils/CanvasUtils.js similarity index 100% rename from TS Source/utils/CanvasUtils.js rename to todo/TS Source/utils/CanvasUtils.js diff --git a/TS Source/utils/CanvasUtils.ts b/todo/TS Source/utils/CanvasUtils.ts similarity index 100% rename from TS Source/utils/CanvasUtils.ts rename to todo/TS Source/utils/CanvasUtils.ts diff --git a/TS Source/utils/CircleUtils.js b/todo/TS Source/utils/CircleUtils.js similarity index 100% rename from TS Source/utils/CircleUtils.js rename to todo/TS Source/utils/CircleUtils.js diff --git a/TS Source/utils/CircleUtils.ts b/todo/TS Source/utils/CircleUtils.ts similarity index 100% rename from TS Source/utils/CircleUtils.ts rename to todo/TS Source/utils/CircleUtils.ts diff --git a/TS Source/utils/ColorUtils.js b/todo/TS Source/utils/ColorUtils.js similarity index 100% rename from TS Source/utils/ColorUtils.js rename to todo/TS Source/utils/ColorUtils.js diff --git a/TS Source/utils/ColorUtils.ts b/todo/TS Source/utils/ColorUtils.ts similarity index 100% rename from TS Source/utils/ColorUtils.ts rename to todo/TS Source/utils/ColorUtils.ts diff --git a/TS Source/utils/DebugUtils.js b/todo/TS Source/utils/DebugUtils.js similarity index 100% rename from TS Source/utils/DebugUtils.js rename to todo/TS Source/utils/DebugUtils.js diff --git a/TS Source/utils/DebugUtils.ts b/todo/TS Source/utils/DebugUtils.ts similarity index 100% rename from TS Source/utils/DebugUtils.ts rename to todo/TS Source/utils/DebugUtils.ts diff --git a/TS Source/utils/PointUtils.js b/todo/TS Source/utils/PointUtils.js similarity index 100% rename from TS Source/utils/PointUtils.js rename to todo/TS Source/utils/PointUtils.js diff --git a/TS Source/utils/PointUtils.ts b/todo/TS Source/utils/PointUtils.ts similarity index 100% rename from TS Source/utils/PointUtils.ts rename to todo/TS Source/utils/PointUtils.ts diff --git a/TS Source/utils/RectangleUtils.js b/todo/TS Source/utils/RectangleUtils.js similarity index 100% rename from TS Source/utils/RectangleUtils.js rename to todo/TS Source/utils/RectangleUtils.js diff --git a/TS Source/utils/RectangleUtils.ts b/todo/TS Source/utils/RectangleUtils.ts similarity index 100% rename from TS Source/utils/RectangleUtils.ts rename to todo/TS Source/utils/RectangleUtils.ts diff --git a/TS Source/utils/SpriteUtils.js b/todo/TS Source/utils/SpriteUtils.js similarity index 100% rename from TS Source/utils/SpriteUtils.js rename to todo/TS Source/utils/SpriteUtils.js diff --git a/TS Source/utils/SpriteUtils.ts b/todo/TS Source/utils/SpriteUtils.ts similarity index 100% rename from TS Source/utils/SpriteUtils.ts rename to todo/TS Source/utils/SpriteUtils.ts diff --git a/TS Source/yuidoc.json b/todo/TS Source/yuidoc.json similarity index 100% rename from TS Source/yuidoc.json rename to todo/TS Source/yuidoc.json diff --git a/TS Tests/.gitignore b/todo/TS Tests/.gitignore similarity index 100% rename from TS Tests/.gitignore rename to todo/TS Tests/.gitignore diff --git a/TS Tests/Phaser Tests.sublime-project b/todo/TS Tests/Phaser Tests.sublime-project similarity index 100% rename from TS Tests/Phaser Tests.sublime-project rename to todo/TS Tests/Phaser Tests.sublime-project diff --git a/TS Tests/Tests.csproj b/todo/TS Tests/Tests.csproj similarity index 100% rename from TS Tests/Tests.csproj rename to todo/TS Tests/Tests.csproj diff --git a/TS Tests/audio/audio sprites 1.js b/todo/TS Tests/audio/audio sprites 1.js similarity index 100% rename from TS Tests/audio/audio sprites 1.js rename to todo/TS Tests/audio/audio sprites 1.js diff --git a/TS Tests/audio/audio sprites 1.ts b/todo/TS Tests/audio/audio sprites 1.ts similarity index 100% rename from TS Tests/audio/audio sprites 1.ts rename to todo/TS Tests/audio/audio sprites 1.ts diff --git a/TS Tests/audio/play sound 1.js b/todo/TS Tests/audio/play sound 1.js similarity index 100% rename from TS Tests/audio/play sound 1.js rename to todo/TS Tests/audio/play sound 1.js diff --git a/TS Tests/audio/play sound 1.ts b/todo/TS Tests/audio/play sound 1.ts similarity index 100% rename from TS Tests/audio/play sound 1.ts rename to todo/TS Tests/audio/play sound 1.ts diff --git a/TS Tests/buttons/basic button 2.js b/todo/TS Tests/buttons/basic button 2.js similarity index 100% rename from TS Tests/buttons/basic button 2.js rename to todo/TS Tests/buttons/basic button 2.js diff --git a/TS Tests/buttons/basic button 2.ts b/todo/TS Tests/buttons/basic button 2.ts similarity index 100% rename from TS Tests/buttons/basic button 2.ts rename to todo/TS Tests/buttons/basic button 2.ts diff --git a/TS Tests/buttons/basic button.js b/todo/TS Tests/buttons/basic button.js similarity index 100% rename from TS Tests/buttons/basic button.js rename to todo/TS Tests/buttons/basic button.js diff --git a/TS Tests/buttons/basic button.ts b/todo/TS Tests/buttons/basic button.ts similarity index 100% rename from TS Tests/buttons/basic button.ts rename to todo/TS Tests/buttons/basic button.ts diff --git a/TS Tests/buttons/camera buttons.js b/todo/TS Tests/buttons/camera buttons.js similarity index 100% rename from TS Tests/buttons/camera buttons.js rename to todo/TS Tests/buttons/camera buttons.js diff --git a/TS Tests/buttons/camera buttons.ts b/todo/TS Tests/buttons/camera buttons.ts similarity index 100% rename from TS Tests/buttons/camera buttons.ts rename to todo/TS Tests/buttons/camera buttons.ts diff --git a/TS Tests/buttons/rotated buttons.js b/todo/TS Tests/buttons/rotated buttons.js similarity index 100% rename from TS Tests/buttons/rotated buttons.js rename to todo/TS Tests/buttons/rotated buttons.js diff --git a/TS Tests/buttons/rotated buttons.ts b/todo/TS Tests/buttons/rotated buttons.ts similarity index 100% rename from TS Tests/buttons/rotated buttons.ts rename to todo/TS Tests/buttons/rotated buttons.ts diff --git a/TS Tests/camera fx/fade.js b/todo/TS Tests/camera fx/fade.js similarity index 100% rename from TS Tests/camera fx/fade.js rename to todo/TS Tests/camera fx/fade.js diff --git a/TS Tests/camera fx/fade.ts b/todo/TS Tests/camera fx/fade.ts similarity index 100% rename from TS Tests/camera fx/fade.ts rename to todo/TS Tests/camera fx/fade.ts diff --git a/TS Tests/camera fx/mirror.js b/todo/TS Tests/camera fx/mirror.js similarity index 100% rename from TS Tests/camera fx/mirror.js rename to todo/TS Tests/camera fx/mirror.js diff --git a/TS Tests/camera fx/mirror.ts b/todo/TS Tests/camera fx/mirror.ts similarity index 100% rename from TS Tests/camera fx/mirror.ts rename to todo/TS Tests/camera fx/mirror.ts diff --git a/TS Tests/camera fx/scanlines.js b/todo/TS Tests/camera fx/scanlines.js similarity index 100% rename from TS Tests/camera fx/scanlines.js rename to todo/TS Tests/camera fx/scanlines.js diff --git a/TS Tests/camera fx/scanlines.ts b/todo/TS Tests/camera fx/scanlines.ts similarity index 100% rename from TS Tests/camera fx/scanlines.ts rename to todo/TS Tests/camera fx/scanlines.ts diff --git a/TS Tests/cameras/basic camera 1.js b/todo/TS Tests/cameras/basic camera 1.js similarity index 100% rename from TS Tests/cameras/basic camera 1.js rename to todo/TS Tests/cameras/basic camera 1.js diff --git a/TS Tests/cameras/basic camera 1.ts b/todo/TS Tests/cameras/basic camera 1.ts similarity index 100% rename from TS Tests/cameras/basic camera 1.ts rename to todo/TS Tests/cameras/basic camera 1.ts diff --git a/TS Tests/cameras/basic follow.js b/todo/TS Tests/cameras/basic follow.js similarity index 100% rename from TS Tests/cameras/basic follow.js rename to todo/TS Tests/cameras/basic follow.js diff --git a/TS Tests/cameras/basic follow.ts b/todo/TS Tests/cameras/basic follow.ts similarity index 100% rename from TS Tests/cameras/basic follow.ts rename to todo/TS Tests/cameras/basic follow.ts diff --git a/TS Tests/cameras/camera alpha.js b/todo/TS Tests/cameras/camera alpha.js similarity index 100% rename from TS Tests/cameras/camera alpha.js rename to todo/TS Tests/cameras/camera alpha.js diff --git a/TS Tests/cameras/camera alpha.ts b/todo/TS Tests/cameras/camera alpha.ts similarity index 100% rename from TS Tests/cameras/camera alpha.ts rename to todo/TS Tests/cameras/camera alpha.ts diff --git a/TS Tests/cameras/camera fx 1.js b/todo/TS Tests/cameras/camera fx 1.js similarity index 100% rename from TS Tests/cameras/camera fx 1.js rename to todo/TS Tests/cameras/camera fx 1.js diff --git a/TS Tests/cameras/camera fx 1.ts b/todo/TS Tests/cameras/camera fx 1.ts similarity index 100% rename from TS Tests/cameras/camera fx 1.ts rename to todo/TS Tests/cameras/camera fx 1.ts diff --git a/TS Tests/cameras/camera fx 2.js b/todo/TS Tests/cameras/camera fx 2.js similarity index 100% rename from TS Tests/cameras/camera fx 2.js rename to todo/TS Tests/cameras/camera fx 2.js diff --git a/TS Tests/cameras/camera fx 2.ts b/todo/TS Tests/cameras/camera fx 2.ts similarity index 100% rename from TS Tests/cameras/camera fx 2.ts rename to todo/TS Tests/cameras/camera fx 2.ts diff --git a/TS Tests/cameras/camera fx 3.js b/todo/TS Tests/cameras/camera fx 3.js similarity index 100% rename from TS Tests/cameras/camera fx 3.js rename to todo/TS Tests/cameras/camera fx 3.js diff --git a/TS Tests/cameras/camera fx 3.ts b/todo/TS Tests/cameras/camera fx 3.ts similarity index 100% rename from TS Tests/cameras/camera fx 3.ts rename to todo/TS Tests/cameras/camera fx 3.ts diff --git a/TS Tests/cameras/camera rotation.js b/todo/TS Tests/cameras/camera rotation.js similarity index 100% rename from TS Tests/cameras/camera rotation.js rename to todo/TS Tests/cameras/camera rotation.js diff --git a/TS Tests/cameras/camera rotation.ts b/todo/TS Tests/cameras/camera rotation.ts similarity index 100% rename from TS Tests/cameras/camera rotation.ts rename to todo/TS Tests/cameras/camera rotation.ts diff --git a/TS Tests/cameras/camera scale.js b/todo/TS Tests/cameras/camera scale.js similarity index 100% rename from TS Tests/cameras/camera scale.js rename to todo/TS Tests/cameras/camera scale.js diff --git a/TS Tests/cameras/camera scale.ts b/todo/TS Tests/cameras/camera scale.ts similarity index 100% rename from TS Tests/cameras/camera scale.ts rename to todo/TS Tests/cameras/camera scale.ts diff --git a/TS Tests/cameras/camera texture.js b/todo/TS Tests/cameras/camera texture.js similarity index 100% rename from TS Tests/cameras/camera texture.js rename to todo/TS Tests/cameras/camera texture.js diff --git a/TS Tests/cameras/camera texture.ts b/todo/TS Tests/cameras/camera texture.ts similarity index 100% rename from TS Tests/cameras/camera texture.ts rename to todo/TS Tests/cameras/camera texture.ts diff --git a/TS Tests/cameras/follow styles.js b/todo/TS Tests/cameras/follow styles.js similarity index 100% rename from TS Tests/cameras/follow styles.js rename to todo/TS Tests/cameras/follow styles.js diff --git a/TS Tests/cameras/follow styles.ts b/todo/TS Tests/cameras/follow styles.ts similarity index 100% rename from TS Tests/cameras/follow styles.ts rename to todo/TS Tests/cameras/follow styles.ts diff --git a/TS Tests/cameras/hide from camera.js b/todo/TS Tests/cameras/hide from camera.js similarity index 100% rename from TS Tests/cameras/hide from camera.js rename to todo/TS Tests/cameras/hide from camera.js diff --git a/TS Tests/cameras/hide from camera.ts b/todo/TS Tests/cameras/hide from camera.ts similarity index 100% rename from TS Tests/cameras/hide from camera.ts rename to todo/TS Tests/cameras/hide from camera.ts diff --git a/TS Tests/cameras/multi camera.js b/todo/TS Tests/cameras/multi camera.js similarity index 100% rename from TS Tests/cameras/multi camera.js rename to todo/TS Tests/cameras/multi camera.js diff --git a/TS Tests/cameras/multi camera.ts b/todo/TS Tests/cameras/multi camera.ts similarity index 100% rename from TS Tests/cameras/multi camera.ts rename to todo/TS Tests/cameras/multi camera.ts diff --git a/TS Tests/cameras/scrollfactor 1.js b/todo/TS Tests/cameras/scrollfactor 1.js similarity index 100% rename from TS Tests/cameras/scrollfactor 1.js rename to todo/TS Tests/cameras/scrollfactor 1.js diff --git a/TS Tests/cameras/scrollfactor 1.ts b/todo/TS Tests/cameras/scrollfactor 1.ts similarity index 100% rename from TS Tests/cameras/scrollfactor 1.ts rename to todo/TS Tests/cameras/scrollfactor 1.ts diff --git a/TS Tests/cameras/scrollfactor 2.js b/todo/TS Tests/cameras/scrollfactor 2.js similarity index 100% rename from TS Tests/cameras/scrollfactor 2.js rename to todo/TS Tests/cameras/scrollfactor 2.js diff --git a/TS Tests/cameras/scrollfactor 2.ts b/todo/TS Tests/cameras/scrollfactor 2.ts similarity index 100% rename from TS Tests/cameras/scrollfactor 2.ts rename to todo/TS Tests/cameras/scrollfactor 2.ts diff --git a/TS Tests/cameras/scrollfactor compare.js b/todo/TS Tests/cameras/scrollfactor compare.js similarity index 100% rename from TS Tests/cameras/scrollfactor compare.js rename to todo/TS Tests/cameras/scrollfactor compare.js diff --git a/TS Tests/cameras/scrollfactor compare.ts b/todo/TS Tests/cameras/scrollfactor compare.ts similarity index 100% rename from TS Tests/cameras/scrollfactor compare.ts rename to todo/TS Tests/cameras/scrollfactor compare.ts diff --git a/TS Tests/cameras/world sprite.js b/todo/TS Tests/cameras/world sprite.js similarity index 100% rename from TS Tests/cameras/world sprite.js rename to todo/TS Tests/cameras/world sprite.js diff --git a/TS Tests/cameras/world sprite.ts b/todo/TS Tests/cameras/world sprite.ts similarity index 100% rename from TS Tests/cameras/world sprite.ts rename to todo/TS Tests/cameras/world sprite.ts diff --git a/TS Tests/display/render crisp.js b/todo/TS Tests/display/render crisp.js similarity index 100% rename from TS Tests/display/render crisp.js rename to todo/TS Tests/display/render crisp.js diff --git a/TS Tests/display/render crisp.ts b/todo/TS Tests/display/render crisp.ts similarity index 100% rename from TS Tests/display/render crisp.ts rename to todo/TS Tests/display/render crisp.ts diff --git a/TS Tests/groups/add to group 1.js b/todo/TS Tests/groups/add to group 1.js similarity index 100% rename from TS Tests/groups/add to group 1.js rename to todo/TS Tests/groups/add to group 1.js diff --git a/TS Tests/groups/add to group 1.ts b/todo/TS Tests/groups/add to group 1.ts similarity index 100% rename from TS Tests/groups/add to group 1.ts rename to todo/TS Tests/groups/add to group 1.ts diff --git a/TS Tests/groups/add to group 2.js b/todo/TS Tests/groups/add to group 2.js similarity index 100% rename from TS Tests/groups/add to group 2.js rename to todo/TS Tests/groups/add to group 2.js diff --git a/TS Tests/groups/add to group 2.ts b/todo/TS Tests/groups/add to group 2.ts similarity index 100% rename from TS Tests/groups/add to group 2.ts rename to todo/TS Tests/groups/add to group 2.ts diff --git a/TS Tests/groups/bring to top 1.js b/todo/TS Tests/groups/bring to top 1.js similarity index 100% rename from TS Tests/groups/bring to top 1.js rename to todo/TS Tests/groups/bring to top 1.js diff --git a/TS Tests/groups/bring to top 1.ts b/todo/TS Tests/groups/bring to top 1.ts similarity index 100% rename from TS Tests/groups/bring to top 1.ts rename to todo/TS Tests/groups/bring to top 1.ts diff --git a/TS Tests/groups/bring to top.js b/todo/TS Tests/groups/bring to top.js similarity index 100% rename from TS Tests/groups/bring to top.js rename to todo/TS Tests/groups/bring to top.js diff --git a/TS Tests/groups/bring to top.ts b/todo/TS Tests/groups/bring to top.ts similarity index 100% rename from TS Tests/groups/bring to top.ts rename to todo/TS Tests/groups/bring to top.ts diff --git a/TS Tests/groups/call all.js b/todo/TS Tests/groups/call all.js similarity index 100% rename from TS Tests/groups/call all.js rename to todo/TS Tests/groups/call all.js diff --git a/TS Tests/groups/call all.ts b/todo/TS Tests/groups/call all.ts similarity index 100% rename from TS Tests/groups/call all.ts rename to todo/TS Tests/groups/call all.ts diff --git a/TS Tests/groups/create group 1.js b/todo/TS Tests/groups/create group 1.js similarity index 100% rename from TS Tests/groups/create group 1.js rename to todo/TS Tests/groups/create group 1.js diff --git a/TS Tests/groups/create group 1.ts b/todo/TS Tests/groups/create group 1.ts similarity index 100% rename from TS Tests/groups/create group 1.ts rename to todo/TS Tests/groups/create group 1.ts diff --git a/TS Tests/groups/direct render.js b/todo/TS Tests/groups/direct render.js similarity index 100% rename from TS Tests/groups/direct render.js rename to todo/TS Tests/groups/direct render.js diff --git a/TS Tests/groups/direct render.ts b/todo/TS Tests/groups/direct render.ts similarity index 100% rename from TS Tests/groups/direct render.ts rename to todo/TS Tests/groups/direct render.ts diff --git a/TS Tests/groups/display order.js b/todo/TS Tests/groups/display order.js similarity index 100% rename from TS Tests/groups/display order.js rename to todo/TS Tests/groups/display order.js diff --git a/TS Tests/groups/display order.ts b/todo/TS Tests/groups/display order.ts similarity index 100% rename from TS Tests/groups/display order.ts rename to todo/TS Tests/groups/display order.ts diff --git a/TS Tests/groups/for each.js b/todo/TS Tests/groups/for each.js similarity index 100% rename from TS Tests/groups/for each.js rename to todo/TS Tests/groups/for each.js diff --git a/TS Tests/groups/for each.ts b/todo/TS Tests/groups/for each.ts similarity index 100% rename from TS Tests/groups/for each.ts rename to todo/TS Tests/groups/for each.ts diff --git a/TS Tests/groups/get first 1.js b/todo/TS Tests/groups/get first 1.js similarity index 100% rename from TS Tests/groups/get first 1.js rename to todo/TS Tests/groups/get first 1.js diff --git a/TS Tests/groups/get first 1.ts b/todo/TS Tests/groups/get first 1.ts similarity index 100% rename from TS Tests/groups/get first 1.ts rename to todo/TS Tests/groups/get first 1.ts diff --git a/TS Tests/groups/get first 2.js b/todo/TS Tests/groups/get first 2.js similarity index 100% rename from TS Tests/groups/get first 2.js rename to todo/TS Tests/groups/get first 2.js diff --git a/TS Tests/groups/get first 2.ts b/todo/TS Tests/groups/get first 2.ts similarity index 100% rename from TS Tests/groups/get first 2.ts rename to todo/TS Tests/groups/get first 2.ts diff --git a/TS Tests/groups/get first 3.js b/todo/TS Tests/groups/get first 3.js similarity index 100% rename from TS Tests/groups/get first 3.js rename to todo/TS Tests/groups/get first 3.js diff --git a/TS Tests/groups/get first 3.ts b/todo/TS Tests/groups/get first 3.ts similarity index 100% rename from TS Tests/groups/get first 3.ts rename to todo/TS Tests/groups/get first 3.ts diff --git a/TS Tests/groups/group as layer.js b/todo/TS Tests/groups/group as layer.js similarity index 100% rename from TS Tests/groups/group as layer.js rename to todo/TS Tests/groups/group as layer.js diff --git a/TS Tests/groups/group as layer.ts b/todo/TS Tests/groups/group as layer.ts similarity index 100% rename from TS Tests/groups/group as layer.ts rename to todo/TS Tests/groups/group as layer.ts diff --git a/TS Tests/groups/group texture.js b/todo/TS Tests/groups/group texture.js similarity index 100% rename from TS Tests/groups/group texture.js rename to todo/TS Tests/groups/group texture.js diff --git a/TS Tests/groups/group transform 1.js b/todo/TS Tests/groups/group transform 1.js similarity index 100% rename from TS Tests/groups/group transform 1.js rename to todo/TS Tests/groups/group transform 1.js diff --git a/TS Tests/groups/group transform 1.ts b/todo/TS Tests/groups/group transform 1.ts similarity index 100% rename from TS Tests/groups/group transform 1.ts rename to todo/TS Tests/groups/group transform 1.ts diff --git a/TS Tests/groups/group transform 2.js b/todo/TS Tests/groups/group transform 2.js similarity index 100% rename from TS Tests/groups/group transform 2.js rename to todo/TS Tests/groups/group transform 2.js diff --git a/TS Tests/groups/group transform 2.ts b/todo/TS Tests/groups/group transform 2.ts similarity index 100% rename from TS Tests/groups/group transform 2.ts rename to todo/TS Tests/groups/group transform 2.ts diff --git a/TS Tests/groups/group transform 3.js b/todo/TS Tests/groups/group transform 3.js similarity index 100% rename from TS Tests/groups/group transform 3.js rename to todo/TS Tests/groups/group transform 3.js diff --git a/TS Tests/groups/group transform 3.ts b/todo/TS Tests/groups/group transform 3.ts similarity index 100% rename from TS Tests/groups/group transform 3.ts rename to todo/TS Tests/groups/group transform 3.ts diff --git a/TS Tests/groups/recycle 1.js b/todo/TS Tests/groups/recycle 1.js similarity index 100% rename from TS Tests/groups/recycle 1.js rename to todo/TS Tests/groups/recycle 1.js diff --git a/TS Tests/groups/recycle 1.ts b/todo/TS Tests/groups/recycle 1.ts similarity index 100% rename from TS Tests/groups/recycle 1.ts rename to todo/TS Tests/groups/recycle 1.ts diff --git a/TS Tests/groups/recycle 2.js b/todo/TS Tests/groups/recycle 2.js similarity index 100% rename from TS Tests/groups/recycle 2.js rename to todo/TS Tests/groups/recycle 2.js diff --git a/TS Tests/groups/recycle 2.ts b/todo/TS Tests/groups/recycle 2.ts similarity index 100% rename from TS Tests/groups/recycle 2.ts rename to todo/TS Tests/groups/recycle 2.ts diff --git a/TS Tests/groups/remove.js b/todo/TS Tests/groups/remove.js similarity index 100% rename from TS Tests/groups/remove.js rename to todo/TS Tests/groups/remove.js diff --git a/TS Tests/groups/remove.ts b/todo/TS Tests/groups/remove.ts similarity index 100% rename from TS Tests/groups/remove.ts rename to todo/TS Tests/groups/remove.ts diff --git a/TS Tests/groups/replace.js b/todo/TS Tests/groups/replace.js similarity index 100% rename from TS Tests/groups/replace.js rename to todo/TS Tests/groups/replace.js diff --git a/TS Tests/groups/replace.ts b/todo/TS Tests/groups/replace.ts similarity index 100% rename from TS Tests/groups/replace.ts rename to todo/TS Tests/groups/replace.ts diff --git a/TS Tests/groups/set all.js b/todo/TS Tests/groups/set all.js similarity index 100% rename from TS Tests/groups/set all.js rename to todo/TS Tests/groups/set all.js diff --git a/TS Tests/groups/set all.ts b/todo/TS Tests/groups/set all.ts similarity index 100% rename from TS Tests/groups/set all.ts rename to todo/TS Tests/groups/set all.ts diff --git a/TS Tests/groups/sort 1.js b/todo/TS Tests/groups/sort 1.js similarity index 100% rename from TS Tests/groups/sort 1.js rename to todo/TS Tests/groups/sort 1.js diff --git a/TS Tests/groups/sort 1.ts b/todo/TS Tests/groups/sort 1.ts similarity index 100% rename from TS Tests/groups/sort 1.ts rename to todo/TS Tests/groups/sort 1.ts diff --git a/TS Tests/groups/sort 2.js b/todo/TS Tests/groups/sort 2.js similarity index 100% rename from TS Tests/groups/sort 2.js rename to todo/TS Tests/groups/sort 2.js diff --git a/TS Tests/groups/sort 2.ts b/todo/TS Tests/groups/sort 2.ts similarity index 100% rename from TS Tests/groups/sort 2.ts rename to todo/TS Tests/groups/sort 2.ts diff --git a/TS Tests/groups/sub groups.js b/todo/TS Tests/groups/sub groups.js similarity index 100% rename from TS Tests/groups/sub groups.js rename to todo/TS Tests/groups/sub groups.js diff --git a/TS Tests/groups/sub groups.ts b/todo/TS Tests/groups/sub groups.ts similarity index 100% rename from TS Tests/groups/sub groups.ts rename to todo/TS Tests/groups/sub groups.ts diff --git a/TS Tests/groups/swap children.js b/todo/TS Tests/groups/swap children.js similarity index 100% rename from TS Tests/groups/swap children.js rename to todo/TS Tests/groups/swap children.js diff --git a/TS Tests/groups/swap children.ts b/todo/TS Tests/groups/swap children.ts similarity index 100% rename from TS Tests/groups/swap children.ts rename to todo/TS Tests/groups/swap children.ts diff --git a/TS Tests/index.php b/todo/TS Tests/index.php similarity index 100% rename from TS Tests/index.php rename to todo/TS Tests/index.php diff --git a/TS Tests/input/bring to top.js b/todo/TS Tests/input/bring to top.js similarity index 100% rename from TS Tests/input/bring to top.js rename to todo/TS Tests/input/bring to top.js diff --git a/TS Tests/input/bring to top.ts b/todo/TS Tests/input/bring to top.ts similarity index 100% rename from TS Tests/input/bring to top.ts rename to todo/TS Tests/input/bring to top.ts diff --git a/TS Tests/input/drag sprite 1.js b/todo/TS Tests/input/drag sprite 1.js similarity index 100% rename from TS Tests/input/drag sprite 1.js rename to todo/TS Tests/input/drag sprite 1.js diff --git a/TS Tests/input/drag sprite 1.ts b/todo/TS Tests/input/drag sprite 1.ts similarity index 100% rename from TS Tests/input/drag sprite 1.ts rename to todo/TS Tests/input/drag sprite 1.ts diff --git a/TS Tests/input/drag sprite 2.js b/todo/TS Tests/input/drag sprite 2.js similarity index 100% rename from TS Tests/input/drag sprite 2.js rename to todo/TS Tests/input/drag sprite 2.js diff --git a/TS Tests/input/drag sprite 2.ts b/todo/TS Tests/input/drag sprite 2.ts similarity index 100% rename from TS Tests/input/drag sprite 2.ts rename to todo/TS Tests/input/drag sprite 2.ts diff --git a/TS Tests/input/drag sprite 3.js b/todo/TS Tests/input/drag sprite 3.js similarity index 100% rename from TS Tests/input/drag sprite 3.js rename to todo/TS Tests/input/drag sprite 3.js diff --git a/TS Tests/input/drag sprite 3.ts b/todo/TS Tests/input/drag sprite 3.ts similarity index 100% rename from TS Tests/input/drag sprite 3.ts rename to todo/TS Tests/input/drag sprite 3.ts diff --git a/TS Tests/input/drop limitation.js b/todo/TS Tests/input/drop limitation.js similarity index 100% rename from TS Tests/input/drop limitation.js rename to todo/TS Tests/input/drop limitation.js diff --git a/TS Tests/input/drop limitation.ts b/todo/TS Tests/input/drop limitation.ts similarity index 100% rename from TS Tests/input/drop limitation.ts rename to todo/TS Tests/input/drop limitation.ts diff --git a/TS Tests/input/game scale 1.js b/todo/TS Tests/input/game scale 1.js similarity index 100% rename from TS Tests/input/game scale 1.js rename to todo/TS Tests/input/game scale 1.js diff --git a/TS Tests/input/game scale 1.ts b/todo/TS Tests/input/game scale 1.ts similarity index 100% rename from TS Tests/input/game scale 1.ts rename to todo/TS Tests/input/game scale 1.ts diff --git a/TS Tests/input/keyboard 1.js b/todo/TS Tests/input/keyboard 1.js similarity index 100% rename from TS Tests/input/keyboard 1.js rename to todo/TS Tests/input/keyboard 1.js diff --git a/TS Tests/input/keyboard 1.ts b/todo/TS Tests/input/keyboard 1.ts similarity index 100% rename from TS Tests/input/keyboard 1.ts rename to todo/TS Tests/input/keyboard 1.ts diff --git a/TS Tests/input/keyboard 2.js b/todo/TS Tests/input/keyboard 2.js similarity index 100% rename from TS Tests/input/keyboard 2.js rename to todo/TS Tests/input/keyboard 2.js diff --git a/TS Tests/input/keyboard 2.ts b/todo/TS Tests/input/keyboard 2.ts similarity index 100% rename from TS Tests/input/keyboard 2.ts rename to todo/TS Tests/input/keyboard 2.ts diff --git a/TS Tests/input/motion lock 2.js b/todo/TS Tests/input/motion lock 2.js similarity index 100% rename from TS Tests/input/motion lock 2.js rename to todo/TS Tests/input/motion lock 2.js diff --git a/TS Tests/input/motion lock 2.ts b/todo/TS Tests/input/motion lock 2.ts similarity index 100% rename from TS Tests/input/motion lock 2.ts rename to todo/TS Tests/input/motion lock 2.ts diff --git a/TS Tests/input/motion lock.js b/todo/TS Tests/input/motion lock.js similarity index 100% rename from TS Tests/input/motion lock.js rename to todo/TS Tests/input/motion lock.js diff --git a/TS Tests/input/motion lock.ts b/todo/TS Tests/input/motion lock.ts similarity index 100% rename from TS Tests/input/motion lock.ts rename to todo/TS Tests/input/motion lock.ts diff --git a/TS Tests/input/multitouch.js b/todo/TS Tests/input/multitouch.js similarity index 100% rename from TS Tests/input/multitouch.js rename to todo/TS Tests/input/multitouch.js diff --git a/TS Tests/input/multitouch.ts b/todo/TS Tests/input/multitouch.ts similarity index 100% rename from TS Tests/input/multitouch.ts rename to todo/TS Tests/input/multitouch.ts diff --git a/TS Tests/input/over sprite 1.js b/todo/TS Tests/input/over sprite 1.js similarity index 100% rename from TS Tests/input/over sprite 1.js rename to todo/TS Tests/input/over sprite 1.js diff --git a/TS Tests/input/over sprite 1.ts b/todo/TS Tests/input/over sprite 1.ts similarity index 100% rename from TS Tests/input/over sprite 1.ts rename to todo/TS Tests/input/over sprite 1.ts diff --git a/TS Tests/input/over sprite 2.js b/todo/TS Tests/input/over sprite 2.js similarity index 100% rename from TS Tests/input/over sprite 2.js rename to todo/TS Tests/input/over sprite 2.js diff --git a/TS Tests/input/over sprite 2.ts b/todo/TS Tests/input/over sprite 2.ts similarity index 100% rename from TS Tests/input/over sprite 2.ts rename to todo/TS Tests/input/over sprite 2.ts diff --git a/TS Tests/input/point in rotated sprite.js b/todo/TS Tests/input/point in rotated sprite.js similarity index 100% rename from TS Tests/input/point in rotated sprite.js rename to todo/TS Tests/input/point in rotated sprite.js diff --git a/TS Tests/input/point in rotated sprite.ts b/todo/TS Tests/input/point in rotated sprite.ts similarity index 100% rename from TS Tests/input/point in rotated sprite.ts rename to todo/TS Tests/input/point in rotated sprite.ts diff --git a/TS Tests/input/rotated sprites.js b/todo/TS Tests/input/rotated sprites.js similarity index 100% rename from TS Tests/input/rotated sprites.js rename to todo/TS Tests/input/rotated sprites.js diff --git a/TS Tests/input/rotated sprites.ts b/todo/TS Tests/input/rotated sprites.ts similarity index 100% rename from TS Tests/input/rotated sprites.ts rename to todo/TS Tests/input/rotated sprites.ts diff --git a/TS Tests/input/snap 1.js b/todo/TS Tests/input/snap 1.js similarity index 100% rename from TS Tests/input/snap 1.js rename to todo/TS Tests/input/snap 1.js diff --git a/TS Tests/input/snap 1.ts b/todo/TS Tests/input/snap 1.ts similarity index 100% rename from TS Tests/input/snap 1.ts rename to todo/TS Tests/input/snap 1.ts diff --git a/TS Tests/input/touch priority.js b/todo/TS Tests/input/touch priority.js similarity index 100% rename from TS Tests/input/touch priority.js rename to todo/TS Tests/input/touch priority.js diff --git a/TS Tests/input/touch priority.ts b/todo/TS Tests/input/touch priority.ts similarity index 100% rename from TS Tests/input/touch priority.ts rename to todo/TS Tests/input/touch priority.ts diff --git a/TS Tests/input/world coordinates.js b/todo/TS Tests/input/world coordinates.js similarity index 100% rename from TS Tests/input/world coordinates.js rename to todo/TS Tests/input/world coordinates.js diff --git a/TS Tests/input/world coordinates.ts b/todo/TS Tests/input/world coordinates.ts similarity index 100% rename from TS Tests/input/world coordinates.ts rename to todo/TS Tests/input/world coordinates.ts diff --git a/TS Tests/input/world drag.js b/todo/TS Tests/input/world drag.js similarity index 100% rename from TS Tests/input/world drag.js rename to todo/TS Tests/input/world drag.js diff --git a/TS Tests/input/world drag.ts b/todo/TS Tests/input/world drag.ts similarity index 100% rename from TS Tests/input/world drag.ts rename to todo/TS Tests/input/world drag.ts diff --git a/TS Tests/misc/boot screen.js b/todo/TS Tests/misc/boot screen.js similarity index 100% rename from TS Tests/misc/boot screen.js rename to todo/TS Tests/misc/boot screen.js diff --git a/TS Tests/misc/boot screen.ts b/todo/TS Tests/misc/boot screen.ts similarity index 100% rename from TS Tests/misc/boot screen.ts rename to todo/TS Tests/misc/boot screen.ts diff --git a/TS Tests/misc/color utils 1.js b/todo/TS Tests/misc/color utils 1.js similarity index 100% rename from TS Tests/misc/color utils 1.js rename to todo/TS Tests/misc/color utils 1.js diff --git a/TS Tests/misc/color utils 1.ts b/todo/TS Tests/misc/color utils 1.ts similarity index 100% rename from TS Tests/misc/color utils 1.ts rename to todo/TS Tests/misc/color utils 1.ts diff --git a/TS Tests/misc/color utils 2.js b/todo/TS Tests/misc/color utils 2.js similarity index 100% rename from TS Tests/misc/color utils 2.js rename to todo/TS Tests/misc/color utils 2.js diff --git a/TS Tests/misc/color utils 2.ts b/todo/TS Tests/misc/color utils 2.ts similarity index 100% rename from TS Tests/misc/color utils 2.ts rename to todo/TS Tests/misc/color utils 2.ts diff --git a/TS Tests/misc/color utils 3.js b/todo/TS Tests/misc/color utils 3.js similarity index 100% rename from TS Tests/misc/color utils 3.js rename to todo/TS Tests/misc/color utils 3.js diff --git a/TS Tests/misc/color utils 3.ts b/todo/TS Tests/misc/color utils 3.ts similarity index 100% rename from TS Tests/misc/color utils 3.ts rename to todo/TS Tests/misc/color utils 3.ts diff --git a/TS Tests/misc/dynamic texture 1.js b/todo/TS Tests/misc/dynamic texture 1.js similarity index 100% rename from TS Tests/misc/dynamic texture 1.js rename to todo/TS Tests/misc/dynamic texture 1.js diff --git a/TS Tests/misc/dynamic texture 1.ts b/todo/TS Tests/misc/dynamic texture 1.ts similarity index 100% rename from TS Tests/misc/dynamic texture 1.ts rename to todo/TS Tests/misc/dynamic texture 1.ts diff --git a/TS Tests/misc/dynamic texture 2.js b/todo/TS Tests/misc/dynamic texture 2.js similarity index 100% rename from TS Tests/misc/dynamic texture 2.js rename to todo/TS Tests/misc/dynamic texture 2.js diff --git a/TS Tests/misc/dynamic texture 2.ts b/todo/TS Tests/misc/dynamic texture 2.ts similarity index 100% rename from TS Tests/misc/dynamic texture 2.ts rename to todo/TS Tests/misc/dynamic texture 2.ts diff --git a/TS Tests/misc/dynamic texture 3.js b/todo/TS Tests/misc/dynamic texture 3.js similarity index 100% rename from TS Tests/misc/dynamic texture 3.js rename to todo/TS Tests/misc/dynamic texture 3.js diff --git a/TS Tests/misc/dynamic texture 3.ts b/todo/TS Tests/misc/dynamic texture 3.ts similarity index 100% rename from TS Tests/misc/dynamic texture 3.ts rename to todo/TS Tests/misc/dynamic texture 3.ts diff --git a/TS Tests/misc/point1.js b/todo/TS Tests/misc/point1.js similarity index 100% rename from TS Tests/misc/point1.js rename to todo/TS Tests/misc/point1.js diff --git a/TS Tests/misc/point1.ts b/todo/TS Tests/misc/point1.ts similarity index 100% rename from TS Tests/misc/point1.ts rename to todo/TS Tests/misc/point1.ts diff --git a/TS Tests/misc/point2.js b/todo/TS Tests/misc/point2.js similarity index 100% rename from TS Tests/misc/point2.js rename to todo/TS Tests/misc/point2.js diff --git a/TS Tests/misc/point2.ts b/todo/TS Tests/misc/point2.ts similarity index 100% rename from TS Tests/misc/point2.ts rename to todo/TS Tests/misc/point2.ts diff --git a/TS Tests/misc/point3.js b/todo/TS Tests/misc/point3.js similarity index 100% rename from TS Tests/misc/point3.js rename to todo/TS Tests/misc/point3.js diff --git a/TS Tests/misc/point3.ts b/todo/TS Tests/misc/point3.ts similarity index 100% rename from TS Tests/misc/point3.ts rename to todo/TS Tests/misc/point3.ts diff --git a/TS Tests/misc/rectangle utils 1.js b/todo/TS Tests/misc/rectangle utils 1.js similarity index 100% rename from TS Tests/misc/rectangle utils 1.js rename to todo/TS Tests/misc/rectangle utils 1.js diff --git a/TS Tests/misc/rectangle utils 1.ts b/todo/TS Tests/misc/rectangle utils 1.ts similarity index 100% rename from TS Tests/misc/rectangle utils 1.ts rename to todo/TS Tests/misc/rectangle utils 1.ts diff --git a/TS Tests/misc/rectangle utils 2.js b/todo/TS Tests/misc/rectangle utils 2.js similarity index 100% rename from TS Tests/misc/rectangle utils 2.js rename to todo/TS Tests/misc/rectangle utils 2.js diff --git a/TS Tests/misc/rectangle utils 2.ts b/todo/TS Tests/misc/rectangle utils 2.ts similarity index 100% rename from TS Tests/misc/rectangle utils 2.ts rename to todo/TS Tests/misc/rectangle utils 2.ts diff --git a/TS Tests/mobile/fullscreen.html b/todo/TS Tests/mobile/fullscreen.html similarity index 100% rename from TS Tests/mobile/fullscreen.html rename to todo/TS Tests/mobile/fullscreen.html diff --git a/TS Tests/mobile/sprite test 1.js b/todo/TS Tests/mobile/sprite test 1.js similarity index 100% rename from TS Tests/mobile/sprite test 1.js rename to todo/TS Tests/mobile/sprite test 1.js diff --git a/TS Tests/mobile/sprite test 1.ts b/todo/TS Tests/mobile/sprite test 1.ts similarity index 100% rename from TS Tests/mobile/sprite test 1.ts rename to todo/TS Tests/mobile/sprite test 1.ts diff --git a/TS Tests/mobile/test1.html b/todo/TS Tests/mobile/test1.html similarity index 100% rename from TS Tests/mobile/test1.html rename to todo/TS Tests/mobile/test1.html diff --git a/TS Tests/particles/graphic emitter.js b/todo/TS Tests/particles/graphic emitter.js similarity index 100% rename from TS Tests/particles/graphic emitter.js rename to todo/TS Tests/particles/graphic emitter.js diff --git a/TS Tests/particles/graphic emitter.ts b/todo/TS Tests/particles/graphic emitter.ts similarity index 100% rename from TS Tests/particles/graphic emitter.ts rename to todo/TS Tests/particles/graphic emitter.ts diff --git a/TS Tests/particles/mousetrail.js b/todo/TS Tests/particles/mousetrail.js similarity index 100% rename from TS Tests/particles/mousetrail.js rename to todo/TS Tests/particles/mousetrail.js diff --git a/TS Tests/particles/mousetrail.ts b/todo/TS Tests/particles/mousetrail.ts similarity index 100% rename from TS Tests/particles/mousetrail.ts rename to todo/TS Tests/particles/mousetrail.ts diff --git a/TS Tests/particles/multiple streams.js b/todo/TS Tests/particles/multiple streams.js similarity index 100% rename from TS Tests/particles/multiple streams.js rename to todo/TS Tests/particles/multiple streams.js diff --git a/TS Tests/particles/multiple streams.ts b/todo/TS Tests/particles/multiple streams.ts similarity index 100% rename from TS Tests/particles/multiple streams.ts rename to todo/TS Tests/particles/multiple streams.ts diff --git a/TS Tests/particles/sprite emitter.js b/todo/TS Tests/particles/sprite emitter.js similarity index 100% rename from TS Tests/particles/sprite emitter.js rename to todo/TS Tests/particles/sprite emitter.js diff --git a/TS Tests/particles/sprite emitter.ts b/todo/TS Tests/particles/sprite emitter.ts similarity index 100% rename from TS Tests/particles/sprite emitter.ts rename to todo/TS Tests/particles/sprite emitter.ts diff --git a/TS Tests/particles/when particles collide.js b/todo/TS Tests/particles/when particles collide.js similarity index 100% rename from TS Tests/particles/when particles collide.js rename to todo/TS Tests/particles/when particles collide.js diff --git a/TS Tests/particles/when particles collide.ts b/todo/TS Tests/particles/when particles collide.ts similarity index 100% rename from TS Tests/particles/when particles collide.ts rename to todo/TS Tests/particles/when particles collide.ts diff --git a/TS Tests/phaser-debug.js b/todo/TS Tests/phaser-debug.js similarity index 100% rename from TS Tests/phaser-debug.js rename to todo/TS Tests/phaser-debug.js diff --git a/TS Tests/phaser-mobile.css b/todo/TS Tests/phaser-mobile.css similarity index 100% rename from TS Tests/phaser-mobile.css rename to todo/TS Tests/phaser-mobile.css diff --git a/TS Tests/phaser.css b/todo/TS Tests/phaser.css similarity index 100% rename from TS Tests/phaser.css rename to todo/TS Tests/phaser.css diff --git a/TS Tests/physics/circle 1.js b/todo/TS Tests/physics/circle 1.js similarity index 100% rename from TS Tests/physics/circle 1.js rename to todo/TS Tests/physics/circle 1.js diff --git a/TS Tests/physics/circle 1.ts b/todo/TS Tests/physics/circle 1.ts similarity index 100% rename from TS Tests/physics/circle 1.ts rename to todo/TS Tests/physics/circle 1.ts diff --git a/TS Tests/physics/sprite bounds.js b/todo/TS Tests/physics/sprite bounds.js similarity index 100% rename from TS Tests/physics/sprite bounds.js rename to todo/TS Tests/physics/sprite bounds.js diff --git a/TS Tests/physics/sprite bounds.ts b/todo/TS Tests/physics/sprite bounds.ts similarity index 100% rename from TS Tests/physics/sprite bounds.ts rename to todo/TS Tests/physics/sprite bounds.ts diff --git a/TS Tests/scrollzones/ballscroller.js b/todo/TS Tests/scrollzones/ballscroller.js similarity index 100% rename from TS Tests/scrollzones/ballscroller.js rename to todo/TS Tests/scrollzones/ballscroller.js diff --git a/TS Tests/scrollzones/ballscroller.ts b/todo/TS Tests/scrollzones/ballscroller.ts similarity index 100% rename from TS Tests/scrollzones/ballscroller.ts rename to todo/TS Tests/scrollzones/ballscroller.ts diff --git a/TS Tests/scrollzones/blasteroids.js b/todo/TS Tests/scrollzones/blasteroids.js similarity index 100% rename from TS Tests/scrollzones/blasteroids.js rename to todo/TS Tests/scrollzones/blasteroids.js diff --git a/TS Tests/scrollzones/blasteroids.ts b/todo/TS Tests/scrollzones/blasteroids.ts similarity index 100% rename from TS Tests/scrollzones/blasteroids.ts rename to todo/TS Tests/scrollzones/blasteroids.ts diff --git a/TS Tests/scrollzones/parallax.js b/todo/TS Tests/scrollzones/parallax.js similarity index 100% rename from TS Tests/scrollzones/parallax.js rename to todo/TS Tests/scrollzones/parallax.js diff --git a/TS Tests/scrollzones/parallax.ts b/todo/TS Tests/scrollzones/parallax.ts similarity index 100% rename from TS Tests/scrollzones/parallax.ts rename to todo/TS Tests/scrollzones/parallax.ts diff --git a/TS Tests/scrollzones/region demo.js b/todo/TS Tests/scrollzones/region demo.js similarity index 100% rename from TS Tests/scrollzones/region demo.js rename to todo/TS Tests/scrollzones/region demo.js diff --git a/TS Tests/scrollzones/region demo.ts b/todo/TS Tests/scrollzones/region demo.ts similarity index 100% rename from TS Tests/scrollzones/region demo.ts rename to todo/TS Tests/scrollzones/region demo.ts diff --git a/TS Tests/scrollzones/scroll window.js b/todo/TS Tests/scrollzones/scroll window.js similarity index 100% rename from TS Tests/scrollzones/scroll window.js rename to todo/TS Tests/scrollzones/scroll window.js diff --git a/TS Tests/scrollzones/scroll window.ts b/todo/TS Tests/scrollzones/scroll window.ts similarity index 100% rename from TS Tests/scrollzones/scroll window.ts rename to todo/TS Tests/scrollzones/scroll window.ts diff --git a/TS Tests/scrollzones/simple scrollzone.js b/todo/TS Tests/scrollzones/simple scrollzone.js similarity index 100% rename from TS Tests/scrollzones/simple scrollzone.js rename to todo/TS Tests/scrollzones/simple scrollzone.js diff --git a/TS Tests/scrollzones/simple scrollzone.ts b/todo/TS Tests/scrollzones/simple scrollzone.ts similarity index 100% rename from TS Tests/scrollzones/simple scrollzone.ts rename to todo/TS Tests/scrollzones/simple scrollzone.ts diff --git a/TS Tests/scrollzones/skewed scroller.js b/todo/TS Tests/scrollzones/skewed scroller.js similarity index 100% rename from TS Tests/scrollzones/skewed scroller.js rename to todo/TS Tests/scrollzones/skewed scroller.js diff --git a/TS Tests/scrollzones/skewed scroller.ts b/todo/TS Tests/scrollzones/skewed scroller.ts similarity index 100% rename from TS Tests/scrollzones/skewed scroller.ts rename to todo/TS Tests/scrollzones/skewed scroller.ts diff --git a/TS Tests/sprites/alpha.js b/todo/TS Tests/sprites/alpha.js similarity index 100% rename from TS Tests/sprites/alpha.js rename to todo/TS Tests/sprites/alpha.js diff --git a/TS Tests/sprites/alpha.ts b/todo/TS Tests/sprites/alpha.ts similarity index 100% rename from TS Tests/sprites/alpha.ts rename to todo/TS Tests/sprites/alpha.ts diff --git a/TS Tests/sprites/animate by framename.js b/todo/TS Tests/sprites/animate by framename.js similarity index 100% rename from TS Tests/sprites/animate by framename.js rename to todo/TS Tests/sprites/animate by framename.js diff --git a/TS Tests/sprites/animate by framename.ts b/todo/TS Tests/sprites/animate by framename.ts similarity index 100% rename from TS Tests/sprites/animate by framename.ts rename to todo/TS Tests/sprites/animate by framename.ts diff --git a/TS Tests/sprites/animation 1.js b/todo/TS Tests/sprites/animation 1.js similarity index 100% rename from TS Tests/sprites/animation 1.js rename to todo/TS Tests/sprites/animation 1.js diff --git a/TS Tests/sprites/animation 1.ts b/todo/TS Tests/sprites/animation 1.ts similarity index 100% rename from TS Tests/sprites/animation 1.ts rename to todo/TS Tests/sprites/animation 1.ts diff --git a/TS Tests/sprites/animation 2.js b/todo/TS Tests/sprites/animation 2.js similarity index 100% rename from TS Tests/sprites/animation 2.js rename to todo/TS Tests/sprites/animation 2.js diff --git a/TS Tests/sprites/animation 2.ts b/todo/TS Tests/sprites/animation 2.ts similarity index 100% rename from TS Tests/sprites/animation 2.ts rename to todo/TS Tests/sprites/animation 2.ts diff --git a/TS Tests/sprites/create sprite 1.js b/todo/TS Tests/sprites/create sprite 1.js similarity index 100% rename from TS Tests/sprites/create sprite 1.js rename to todo/TS Tests/sprites/create sprite 1.js diff --git a/TS Tests/sprites/create sprite 1.ts b/todo/TS Tests/sprites/create sprite 1.ts similarity index 100% rename from TS Tests/sprites/create sprite 1.ts rename to todo/TS Tests/sprites/create sprite 1.ts diff --git a/TS Tests/sprites/origin 5.js b/todo/TS Tests/sprites/origin 5.js similarity index 100% rename from TS Tests/sprites/origin 5.js rename to todo/TS Tests/sprites/origin 5.js diff --git a/TS Tests/sprites/origin 5.ts b/todo/TS Tests/sprites/origin 5.ts similarity index 100% rename from TS Tests/sprites/origin 5.ts rename to todo/TS Tests/sprites/origin 5.ts diff --git a/TS Tests/sprites/out of screen.js b/todo/TS Tests/sprites/out of screen.js similarity index 100% rename from TS Tests/sprites/out of screen.js rename to todo/TS Tests/sprites/out of screen.js diff --git a/TS Tests/sprites/out of screen.ts b/todo/TS Tests/sprites/out of screen.ts similarity index 100% rename from TS Tests/sprites/out of screen.ts rename to todo/TS Tests/sprites/out of screen.ts diff --git a/TS Tests/sprites/rotate around.js b/todo/TS Tests/sprites/rotate around.js similarity index 100% rename from TS Tests/sprites/rotate around.js rename to todo/TS Tests/sprites/rotate around.js diff --git a/TS Tests/sprites/rotate around.ts b/todo/TS Tests/sprites/rotate around.ts similarity index 100% rename from TS Tests/sprites/rotate around.ts rename to todo/TS Tests/sprites/rotate around.ts diff --git a/TS Tests/sprites/scale sprite 1.js b/todo/TS Tests/sprites/scale sprite 1.js similarity index 100% rename from TS Tests/sprites/scale sprite 1.js rename to todo/TS Tests/sprites/scale sprite 1.js diff --git a/TS Tests/sprites/scale sprite 1.ts b/todo/TS Tests/sprites/scale sprite 1.ts similarity index 100% rename from TS Tests/sprites/scale sprite 1.ts rename to todo/TS Tests/sprites/scale sprite 1.ts diff --git a/TS Tests/sprites/scale sprite 2.js b/todo/TS Tests/sprites/scale sprite 2.js similarity index 100% rename from TS Tests/sprites/scale sprite 2.js rename to todo/TS Tests/sprites/scale sprite 2.js diff --git a/TS Tests/sprites/scale sprite 2.ts b/todo/TS Tests/sprites/scale sprite 2.ts similarity index 100% rename from TS Tests/sprites/scale sprite 2.ts rename to todo/TS Tests/sprites/scale sprite 2.ts diff --git a/TS Tests/sprites/scale sprite 3.js b/todo/TS Tests/sprites/scale sprite 3.js similarity index 100% rename from TS Tests/sprites/scale sprite 3.js rename to todo/TS Tests/sprites/scale sprite 3.js diff --git a/TS Tests/sprites/scale sprite 3.ts b/todo/TS Tests/sprites/scale sprite 3.ts similarity index 100% rename from TS Tests/sprites/scale sprite 3.ts rename to todo/TS Tests/sprites/scale sprite 3.ts diff --git a/TS Tests/sprites/scale sprite 4.js b/todo/TS Tests/sprites/scale sprite 4.js similarity index 100% rename from TS Tests/sprites/scale sprite 4.js rename to todo/TS Tests/sprites/scale sprite 4.js diff --git a/TS Tests/sprites/scale sprite 4.ts b/todo/TS Tests/sprites/scale sprite 4.ts similarity index 100% rename from TS Tests/sprites/scale sprite 4.ts rename to todo/TS Tests/sprites/scale sprite 4.ts diff --git a/TS Tests/sprites/scale sprite 5.js b/todo/TS Tests/sprites/scale sprite 5.js similarity index 100% rename from TS Tests/sprites/scale sprite 5.js rename to todo/TS Tests/sprites/scale sprite 5.js diff --git a/TS Tests/sprites/scale sprite 5.ts b/todo/TS Tests/sprites/scale sprite 5.ts similarity index 100% rename from TS Tests/sprites/scale sprite 5.ts rename to todo/TS Tests/sprites/scale sprite 5.ts diff --git a/TS Tests/sprites/sprite origin 1.js b/todo/TS Tests/sprites/sprite origin 1.js similarity index 100% rename from TS Tests/sprites/sprite origin 1.js rename to todo/TS Tests/sprites/sprite origin 1.js diff --git a/TS Tests/sprites/sprite origin 1.ts b/todo/TS Tests/sprites/sprite origin 1.ts similarity index 100% rename from TS Tests/sprites/sprite origin 1.ts rename to todo/TS Tests/sprites/sprite origin 1.ts diff --git a/TS Tests/sprites/sprite origin 2.js b/todo/TS Tests/sprites/sprite origin 2.js similarity index 100% rename from TS Tests/sprites/sprite origin 2.js rename to todo/TS Tests/sprites/sprite origin 2.js diff --git a/TS Tests/sprites/sprite origin 2.ts b/todo/TS Tests/sprites/sprite origin 2.ts similarity index 100% rename from TS Tests/sprites/sprite origin 2.ts rename to todo/TS Tests/sprites/sprite origin 2.ts diff --git a/TS Tests/sprites/sprite origin 3.js b/todo/TS Tests/sprites/sprite origin 3.js similarity index 100% rename from TS Tests/sprites/sprite origin 3.js rename to todo/TS Tests/sprites/sprite origin 3.js diff --git a/TS Tests/sprites/sprite origin 3.ts b/todo/TS Tests/sprites/sprite origin 3.ts similarity index 100% rename from TS Tests/sprites/sprite origin 3.ts rename to todo/TS Tests/sprites/sprite origin 3.ts diff --git a/TS Tests/sprites/sprite origin 4.js b/todo/TS Tests/sprites/sprite origin 4.js similarity index 100% rename from TS Tests/sprites/sprite origin 4.js rename to todo/TS Tests/sprites/sprite origin 4.js diff --git a/TS Tests/sprites/sprite origin 4.ts b/todo/TS Tests/sprites/sprite origin 4.ts similarity index 100% rename from TS Tests/sprites/sprite origin 4.ts rename to todo/TS Tests/sprites/sprite origin 4.ts diff --git a/TS Tests/stage/blur filter.js b/todo/TS Tests/stage/blur filter.js similarity index 100% rename from TS Tests/stage/blur filter.js rename to todo/TS Tests/stage/blur filter.js diff --git a/TS Tests/stage/blur filter.ts b/todo/TS Tests/stage/blur filter.ts similarity index 100% rename from TS Tests/stage/blur filter.ts rename to todo/TS Tests/stage/blur filter.ts diff --git a/TS Tests/stage/brightness filter.js b/todo/TS Tests/stage/brightness filter.js similarity index 100% rename from TS Tests/stage/brightness filter.js rename to todo/TS Tests/stage/brightness filter.js diff --git a/TS Tests/stage/brightness filter.ts b/todo/TS Tests/stage/brightness filter.ts similarity index 100% rename from TS Tests/stage/brightness filter.ts rename to todo/TS Tests/stage/brightness filter.ts diff --git a/TS Tests/stage/contrast filter.js b/todo/TS Tests/stage/contrast filter.js similarity index 100% rename from TS Tests/stage/contrast filter.js rename to todo/TS Tests/stage/contrast filter.js diff --git a/TS Tests/stage/contrast filter.ts b/todo/TS Tests/stage/contrast filter.ts similarity index 100% rename from TS Tests/stage/contrast filter.ts rename to todo/TS Tests/stage/contrast filter.ts diff --git a/TS Tests/stage/grayscale filter.js b/todo/TS Tests/stage/grayscale filter.js similarity index 100% rename from TS Tests/stage/grayscale filter.js rename to todo/TS Tests/stage/grayscale filter.js diff --git a/TS Tests/stage/grayscale filter.ts b/todo/TS Tests/stage/grayscale filter.ts similarity index 100% rename from TS Tests/stage/grayscale filter.ts rename to todo/TS Tests/stage/grayscale filter.ts diff --git a/TS Tests/stage/hue rotate filter.js b/todo/TS Tests/stage/hue rotate filter.js similarity index 100% rename from TS Tests/stage/hue rotate filter.js rename to todo/TS Tests/stage/hue rotate filter.js diff --git a/TS Tests/stage/hue rotate filter.ts b/todo/TS Tests/stage/hue rotate filter.ts similarity index 100% rename from TS Tests/stage/hue rotate filter.ts rename to todo/TS Tests/stage/hue rotate filter.ts diff --git a/TS Tests/stage/sepia filter.js b/todo/TS Tests/stage/sepia filter.js similarity index 100% rename from TS Tests/stage/sepia filter.js rename to todo/TS Tests/stage/sepia filter.js diff --git a/TS Tests/stage/sepia filter.ts b/todo/TS Tests/stage/sepia filter.ts similarity index 100% rename from TS Tests/stage/sepia filter.ts rename to todo/TS Tests/stage/sepia filter.ts diff --git a/TS Tests/states/javascript/FakeGame.js b/todo/TS Tests/states/javascript/FakeGame.js similarity index 100% rename from TS Tests/states/javascript/FakeGame.js rename to todo/TS Tests/states/javascript/FakeGame.js diff --git a/TS Tests/states/javascript/MainMenu.js b/todo/TS Tests/states/javascript/MainMenu.js similarity index 100% rename from TS Tests/states/javascript/MainMenu.js rename to todo/TS Tests/states/javascript/MainMenu.js diff --git a/TS Tests/states/javascript/index.html b/todo/TS Tests/states/javascript/index.html similarity index 100% rename from TS Tests/states/javascript/index.html rename to todo/TS Tests/states/javascript/index.html diff --git a/TS Tests/states/typescript/FakeGame.ts b/todo/TS Tests/states/typescript/FakeGame.ts similarity index 100% rename from TS Tests/states/typescript/FakeGame.ts rename to todo/TS Tests/states/typescript/FakeGame.ts diff --git a/TS Tests/states/typescript/MainMenu.ts b/todo/TS Tests/states/typescript/MainMenu.ts similarity index 100% rename from TS Tests/states/typescript/MainMenu.ts rename to todo/TS Tests/states/typescript/MainMenu.ts diff --git a/TS Tests/states/typescript/index.html b/todo/TS Tests/states/typescript/index.html similarity index 100% rename from TS Tests/states/typescript/index.html rename to todo/TS Tests/states/typescript/index.html diff --git a/TS Tests/textures/dynamic texture 1.js b/todo/TS Tests/textures/dynamic texture 1.js similarity index 100% rename from TS Tests/textures/dynamic texture 1.js rename to todo/TS Tests/textures/dynamic texture 1.js diff --git a/TS Tests/textures/dynamic texture 1.ts b/todo/TS Tests/textures/dynamic texture 1.ts similarity index 100% rename from TS Tests/textures/dynamic texture 1.ts rename to todo/TS Tests/textures/dynamic texture 1.ts diff --git a/TS Tests/textures/dynamic texture 2.js b/todo/TS Tests/textures/dynamic texture 2.js similarity index 100% rename from TS Tests/textures/dynamic texture 2.js rename to todo/TS Tests/textures/dynamic texture 2.js diff --git a/TS Tests/textures/dynamic texture 2.ts b/todo/TS Tests/textures/dynamic texture 2.ts similarity index 100% rename from TS Tests/textures/dynamic texture 2.ts rename to todo/TS Tests/textures/dynamic texture 2.ts diff --git a/TS Tests/textures/filter test.js b/todo/TS Tests/textures/filter test.js similarity index 100% rename from TS Tests/textures/filter test.js rename to todo/TS Tests/textures/filter test.js diff --git a/TS Tests/textures/filter test.ts b/todo/TS Tests/textures/filter test.ts similarity index 100% rename from TS Tests/textures/filter test.ts rename to todo/TS Tests/textures/filter test.ts diff --git a/TS Tests/textures/starling texture atlas.js b/todo/TS Tests/textures/starling texture atlas.js similarity index 100% rename from TS Tests/textures/starling texture atlas.js rename to todo/TS Tests/textures/starling texture atlas.js diff --git a/TS Tests/textures/starling texture atlas.ts b/todo/TS Tests/textures/starling texture atlas.ts similarity index 100% rename from TS Tests/textures/starling texture atlas.ts rename to todo/TS Tests/textures/starling texture atlas.ts diff --git a/TS Tests/textures/texture atlas 1.js b/todo/TS Tests/textures/texture atlas 1.js similarity index 100% rename from TS Tests/textures/texture atlas 1.js rename to todo/TS Tests/textures/texture atlas 1.js diff --git a/TS Tests/textures/texture atlas 1.ts b/todo/TS Tests/textures/texture atlas 1.ts similarity index 100% rename from TS Tests/textures/texture atlas 1.ts rename to todo/TS Tests/textures/texture atlas 1.ts diff --git a/TS Tests/textures/texture atlas 2.js b/todo/TS Tests/textures/texture atlas 2.js similarity index 100% rename from TS Tests/textures/texture atlas 2.js rename to todo/TS Tests/textures/texture atlas 2.js diff --git a/TS Tests/textures/texture atlas 2.ts b/todo/TS Tests/textures/texture atlas 2.ts similarity index 100% rename from TS Tests/textures/texture atlas 2.ts rename to todo/TS Tests/textures/texture atlas 2.ts diff --git a/TS Tests/textures/texture atlas 3.js b/todo/TS Tests/textures/texture atlas 3.js similarity index 100% rename from TS Tests/textures/texture atlas 3.js rename to todo/TS Tests/textures/texture atlas 3.js diff --git a/TS Tests/textures/texture atlas 3.ts b/todo/TS Tests/textures/texture atlas 3.ts similarity index 100% rename from TS Tests/textures/texture atlas 3.ts rename to todo/TS Tests/textures/texture atlas 3.ts diff --git a/TS Tests/textures/texture atlas 4.js b/todo/TS Tests/textures/texture atlas 4.js similarity index 100% rename from TS Tests/textures/texture atlas 4.js rename to todo/TS Tests/textures/texture atlas 4.js diff --git a/TS Tests/textures/texture atlas 4.ts b/todo/TS Tests/textures/texture atlas 4.ts similarity index 100% rename from TS Tests/textures/texture atlas 4.ts rename to todo/TS Tests/textures/texture atlas 4.ts diff --git a/TS Tests/tilemaps/csv tilemap.js b/todo/TS Tests/tilemaps/csv tilemap.js similarity index 100% rename from TS Tests/tilemaps/csv tilemap.js rename to todo/TS Tests/tilemaps/csv tilemap.js diff --git a/TS Tests/tilemaps/csv tilemap.ts b/todo/TS Tests/tilemaps/csv tilemap.ts similarity index 100% rename from TS Tests/tilemaps/csv tilemap.ts rename to todo/TS Tests/tilemaps/csv tilemap.ts diff --git a/TS Tests/tilemaps/map draw.js b/todo/TS Tests/tilemaps/map draw.js similarity index 100% rename from TS Tests/tilemaps/map draw.js rename to todo/TS Tests/tilemaps/map draw.js diff --git a/TS Tests/tilemaps/map draw.ts b/todo/TS Tests/tilemaps/map draw.ts similarity index 100% rename from TS Tests/tilemaps/map draw.ts rename to todo/TS Tests/tilemaps/map draw.ts diff --git a/TS Tests/tilemaps/tiled layers.js b/todo/TS Tests/tilemaps/tiled layers.js similarity index 100% rename from TS Tests/tilemaps/tiled layers.js rename to todo/TS Tests/tilemaps/tiled layers.js diff --git a/TS Tests/tilemaps/tiled layers.ts b/todo/TS Tests/tilemaps/tiled layers.ts similarity index 100% rename from TS Tests/tilemaps/tiled layers.ts rename to todo/TS Tests/tilemaps/tiled layers.ts diff --git a/TS Tests/tilemaps/tiled tilemap.js b/todo/TS Tests/tilemaps/tiled tilemap.js similarity index 100% rename from TS Tests/tilemaps/tiled tilemap.js rename to todo/TS Tests/tilemaps/tiled tilemap.js diff --git a/TS Tests/tilemaps/tiled tilemap.ts b/todo/TS Tests/tilemaps/tiled tilemap.ts similarity index 100% rename from TS Tests/tilemaps/tiled tilemap.ts rename to todo/TS Tests/tilemaps/tiled tilemap.ts diff --git a/TS Tests/tweens/bounce.js b/todo/TS Tests/tweens/bounce.js similarity index 100% rename from TS Tests/tweens/bounce.js rename to todo/TS Tests/tweens/bounce.js diff --git a/TS Tests/tweens/bounce.ts b/todo/TS Tests/tweens/bounce.ts similarity index 100% rename from TS Tests/tweens/bounce.ts rename to todo/TS Tests/tweens/bounce.ts diff --git a/TS Tests/tweens/easing example 1.js b/todo/TS Tests/tweens/easing example 1.js similarity index 100% rename from TS Tests/tweens/easing example 1.js rename to todo/TS Tests/tweens/easing example 1.js diff --git a/TS Tests/tweens/easing example 1.ts b/todo/TS Tests/tweens/easing example 1.ts similarity index 100% rename from TS Tests/tweens/easing example 1.ts rename to todo/TS Tests/tweens/easing example 1.ts diff --git a/TS Tests/tweens/easing example 2.js b/todo/TS Tests/tweens/easing example 2.js similarity index 100% rename from TS Tests/tweens/easing example 2.js rename to todo/TS Tests/tweens/easing example 2.js diff --git a/TS Tests/tweens/easing example 2.ts b/todo/TS Tests/tweens/easing example 2.ts similarity index 100% rename from TS Tests/tweens/easing example 2.ts rename to todo/TS Tests/tweens/easing example 2.ts diff --git a/TS Tests/tweens/easing example 3.js b/todo/TS Tests/tweens/easing example 3.js similarity index 100% rename from TS Tests/tweens/easing example 3.js rename to todo/TS Tests/tweens/easing example 3.js diff --git a/TS Tests/tweens/easing example 3.ts b/todo/TS Tests/tweens/easing example 3.ts similarity index 100% rename from TS Tests/tweens/easing example 3.ts rename to todo/TS Tests/tweens/easing example 3.ts diff --git a/TS Tests/tweens/easing example 4.js b/todo/TS Tests/tweens/easing example 4.js similarity index 100% rename from TS Tests/tweens/easing example 4.js rename to todo/TS Tests/tweens/easing example 4.js diff --git a/TS Tests/tweens/easing example 4.ts b/todo/TS Tests/tweens/easing example 4.ts similarity index 100% rename from TS Tests/tweens/easing example 4.ts rename to todo/TS Tests/tweens/easing example 4.ts diff --git a/TS Tests/tweens/easing example 5.js b/todo/TS Tests/tweens/easing example 5.js similarity index 100% rename from TS Tests/tweens/easing example 5.js rename to todo/TS Tests/tweens/easing example 5.js diff --git a/TS Tests/tweens/easing example 5.ts b/todo/TS Tests/tweens/easing example 5.ts similarity index 100% rename from TS Tests/tweens/easing example 5.ts rename to todo/TS Tests/tweens/easing example 5.ts diff --git a/TS Tests/tweens/easing example 6.js b/todo/TS Tests/tweens/easing example 6.js similarity index 100% rename from TS Tests/tweens/easing example 6.js rename to todo/TS Tests/tweens/easing example 6.js diff --git a/TS Tests/tweens/easing example 6.ts b/todo/TS Tests/tweens/easing example 6.ts similarity index 100% rename from TS Tests/tweens/easing example 6.ts rename to todo/TS Tests/tweens/easing example 6.ts diff --git a/TS Tests/tweens/pause test.js b/todo/TS Tests/tweens/pause test.js similarity index 100% rename from TS Tests/tweens/pause test.js rename to todo/TS Tests/tweens/pause test.js diff --git a/TS Tests/tweens/pause test.ts b/todo/TS Tests/tweens/pause test.ts similarity index 100% rename from TS Tests/tweens/pause test.ts rename to todo/TS Tests/tweens/pause test.ts diff --git a/TS Tests/tweens/tween loop 1.js b/todo/TS Tests/tweens/tween loop 1.js similarity index 100% rename from TS Tests/tweens/tween loop 1.js rename to todo/TS Tests/tweens/tween loop 1.js diff --git a/TS Tests/tweens/tween loop 1.ts b/todo/TS Tests/tweens/tween loop 1.ts similarity index 100% rename from TS Tests/tweens/tween loop 1.ts rename to todo/TS Tests/tweens/tween loop 1.ts diff --git a/TS Tests/tweens/tween loop 2.js b/todo/TS Tests/tweens/tween loop 2.js similarity index 100% rename from TS Tests/tweens/tween loop 2.js rename to todo/TS Tests/tweens/tween loop 2.js diff --git a/TS Tests/tweens/tween loop 2.ts b/todo/TS Tests/tweens/tween loop 2.ts similarity index 100% rename from TS Tests/tweens/tween loop 2.ts rename to todo/TS Tests/tweens/tween loop 2.ts diff --git a/todo/Tween.js b/todo/Tween.js deleted file mode 100644 index 0c24a5d0..00000000 --- a/todo/Tween.js +++ /dev/null @@ -1,724 +0,0 @@ -/** - * @author sole / http://soledadpenades.com - * @author mrdoob / http://mrdoob.com - * @author Robert Eisele / http://www.xarg.org - * @author Philippe / http://philippe.elsass.me - * @author Robert Penner / http://www.robertpenner.com/easing_terms_of_use.html - * @author Paul Lewis / http://www.aerotwist.com/ - * @author lechecacharro - * @author Josh Faul / http://jocafa.com/ - * @author egraether / http://egraether.com/ - * @author endel / http://endel.me - * @author Ben Delarre / http://delarre.net - */ - -// Date.now shim for (ahem) Internet Explo(d|r)er -if ( Date.now === undefined ) { - - Date.now = function () { - - return new Date().valueOf(); - - }; - -} - -var TWEEN = TWEEN || ( function () { - - var _tweens = []; - - return { - - REVISION: '11dev', - - getAll: function () { - - return _tweens; - - }, - - removeAll: function () { - - _tweens = []; - - }, - - add: function ( tween ) { - - _tweens.push( tween ); - - }, - - remove: function ( tween ) { - - var i = _tweens.indexOf( tween ); - - if ( i !== -1 ) { - - _tweens.splice( i, 1 ); - - } - - }, - - update: function ( time ) { - - if ( _tweens.length === 0 ) return false; - - var i = 0, numTweens = _tweens.length; - - time = time !== undefined ? time : ( typeof window !== 'undefined' && window.performance !== undefined && window.performance.now !== undefined ? window.performance.now() : Date.now() ); - - while ( i < numTweens ) { - - if ( _tweens[ i ].update( time ) ) { - - i ++; - - } else { - - _tweens.splice( i, 1 ); - - numTweens --; - - } - - } - - return true; - - } - }; - -} )(); - -TWEEN.Tween = function ( object ) { - - var _object = object; - var _valuesStart = {}; - var _valuesEnd = {}; - var _valuesStartRepeat = {}; - var _duration = 1000; - var _repeat = 0; - var _yoyo = false; - var _reversed = false; - var _delayTime = 0; - var _startTime = null; - var _easingFunction = TWEEN.Easing.Linear.None; - var _interpolationFunction = TWEEN.Interpolation.Linear; - var _chainedTweens = []; - var _onStartCallback = null; - var _onStartCallbackFired = false; - var _onUpdateCallback = null; - var _onCompleteCallback = null; - - // Set all starting values present on the target object - for ( var field in object ) { - - _valuesStart[ field ] = parseFloat(object[field], 10); - - } - - this.to = function ( properties, duration ) { - - if ( duration !== undefined ) { - - _duration = duration; - - } - - _valuesEnd = properties; - - return this; - - }; - - this.start = function ( time ) { - - TWEEN.add( this ); - - _onStartCallbackFired = false; - - _startTime = time !== undefined ? time : ( typeof window !== 'undefined' && window.performance !== undefined && window.performance.now !== undefined ? window.performance.now() : Date.now() ); - _startTime += _delayTime; - - for ( var property in _valuesEnd ) { - - // check if an Array was provided as property value - if ( _valuesEnd[ property ] instanceof Array ) { - - if ( _valuesEnd[ property ].length === 0 ) { - - continue; - - } - - // create a local copy of the Array with the start value at the front - _valuesEnd[ property ] = [ _object[ property ] ].concat( _valuesEnd[ property ] ); - - } - - _valuesStart[ property ] = _object[ property ]; - - if( ( _valuesStart[ property ] instanceof Array ) === false ) { - _valuesStart[ property ] *= 1.0; // Ensures we're using numbers, not strings - } - - _valuesStartRepeat[ property ] = _valuesStart[ property ] || 0; - - } - - return this; - - }; - - this.stop = function () { - - TWEEN.remove( this ); - return this; - - }; - - this.delay = function ( amount ) { - - _delayTime = amount; - return this; - - }; - - this.repeat = function ( times ) { - - _repeat = times; - return this; - - }; - - this.yoyo = function( yoyo ) { - - _yoyo = yoyo; - return this; - - }; - - - this.easing = function ( easing ) { - - _easingFunction = easing; - return this; - - }; - - this.interpolation = function ( interpolation ) { - - _interpolationFunction = interpolation; - return this; - - }; - - this.chain = function () { - - _chainedTweens = arguments; - return this; - - }; - - this.onStart = function ( callback ) { - - _onStartCallback = callback; - return this; - - }; - - this.onUpdate = function ( callback ) { - - _onUpdateCallback = callback; - return this; - - }; - - this.onComplete = function ( callback ) { - - _onCompleteCallback = callback; - return this; - - }; - - this.update = function ( time ) { - - var property; - - if ( time < _startTime ) { - - return true; - - } - - if ( _onStartCallbackFired === false ) { - - if ( _onStartCallback !== null ) { - - _onStartCallback.call( _object ); - - } - - _onStartCallbackFired = true; - - } - - var elapsed = ( time - _startTime ) / _duration; - elapsed = elapsed > 1 ? 1 : elapsed; - - var value = _easingFunction( elapsed ); - - for ( property in _valuesEnd ) { - - var start = _valuesStart[ property ] || 0; - var end = _valuesEnd[ property ]; - - if ( end instanceof Array ) { - - _object[ property ] = _interpolationFunction( end, value ); - - } else { - - // Parses relative end values with start as base (e.g.: +10, -3) - if ( typeof(end) === "string" ) { - end = start + parseFloat(end, 10); - } - - // protect against non numeric properties. - if ( typeof(end) === "number" ) { - _object[ property ] = start + ( end - start ) * value; - } - - } - - } - - if ( _onUpdateCallback !== null ) { - - _onUpdateCallback.call( _object, value ); - - } - - if ( elapsed == 1 ) { - - if ( _repeat > 0 ) { - - if( isFinite( _repeat ) ) { - _repeat--; - } - - // reassign starting values, restart by making startTime = now - for( property in _valuesStartRepeat ) { - - if ( typeof( _valuesEnd[ property ] ) === "string" ) { - _valuesStartRepeat[ property ] = _valuesStartRepeat[ property ] + parseFloat(_valuesEnd[ property ], 10); - } - - if (_yoyo) { - var tmp = _valuesStartRepeat[ property ]; - _valuesStartRepeat[ property ] = _valuesEnd[ property ]; - _valuesEnd[ property ] = tmp; - _reversed = !_reversed; - } - _valuesStart[ property ] = _valuesStartRepeat[ property ]; - - } - - _startTime = time + _delayTime; - - return true; - - } else { - - if ( _onCompleteCallback !== null ) { - - _onCompleteCallback.call( _object ); - - } - - for ( var i = 0, numChainedTweens = _chainedTweens.length; i < numChainedTweens; i ++ ) { - - _chainedTweens[ i ].start( time ); - - } - - return false; - - } - - } - - return true; - - }; - -}; - - -TWEEN.Easing = { - - Linear: { - - None: function ( k ) { - - return k; - - } - - }, - - Quadratic: { - - In: function ( k ) { - - return k * k; - - }, - - Out: function ( k ) { - - return k * ( 2 - k ); - - }, - - InOut: function ( k ) { - - if ( ( k *= 2 ) < 1 ) return 0.5 * k * k; - return - 0.5 * ( --k * ( k - 2 ) - 1 ); - - } - - }, - - Cubic: { - - In: function ( k ) { - - return k * k * k; - - }, - - Out: function ( k ) { - - return --k * k * k + 1; - - }, - - InOut: function ( k ) { - - if ( ( k *= 2 ) < 1 ) return 0.5 * k * k * k; - return 0.5 * ( ( k -= 2 ) * k * k + 2 ); - - } - - }, - - Quartic: { - - In: function ( k ) { - - return k * k * k * k; - - }, - - Out: function ( k ) { - - return 1 - ( --k * k * k * k ); - - }, - - InOut: function ( k ) { - - if ( ( k *= 2 ) < 1) return 0.5 * k * k * k * k; - return - 0.5 * ( ( k -= 2 ) * k * k * k - 2 ); - - } - - }, - - Quintic: { - - In: function ( k ) { - - return k * k * k * k * k; - - }, - - Out: function ( k ) { - - return --k * k * k * k * k + 1; - - }, - - InOut: function ( k ) { - - if ( ( k *= 2 ) < 1 ) return 0.5 * k * k * k * k * k; - return 0.5 * ( ( k -= 2 ) * k * k * k * k + 2 ); - - } - - }, - - Sinusoidal: { - - In: function ( k ) { - - return 1 - Math.cos( k * Math.PI / 2 ); - - }, - - Out: function ( k ) { - - return Math.sin( k * Math.PI / 2 ); - - }, - - InOut: function ( k ) { - - return 0.5 * ( 1 - Math.cos( Math.PI * k ) ); - - } - - }, - - Exponential: { - - In: function ( k ) { - - return k === 0 ? 0 : Math.pow( 1024, k - 1 ); - - }, - - Out: function ( k ) { - - return k === 1 ? 1 : 1 - Math.pow( 2, - 10 * k ); - - }, - - InOut: function ( k ) { - - if ( k === 0 ) return 0; - if ( k === 1 ) return 1; - if ( ( k *= 2 ) < 1 ) return 0.5 * Math.pow( 1024, k - 1 ); - return 0.5 * ( - Math.pow( 2, - 10 * ( k - 1 ) ) + 2 ); - - } - - }, - - Circular: { - - In: function ( k ) { - - return 1 - Math.sqrt( 1 - k * k ); - - }, - - Out: function ( k ) { - - return Math.sqrt( 1 - ( --k * k ) ); - - }, - - InOut: function ( k ) { - - if ( ( k *= 2 ) < 1) return - 0.5 * ( Math.sqrt( 1 - k * k) - 1); - return 0.5 * ( Math.sqrt( 1 - ( k -= 2) * k) + 1); - - } - - }, - - Elastic: { - - In: function ( k ) { - - var s, a = 0.1, p = 0.4; - if ( k === 0 ) return 0; - if ( k === 1 ) return 1; - if ( !a || a < 1 ) { a = 1; s = p / 4; } - else s = p * Math.asin( 1 / a ) / ( 2 * Math.PI ); - return - ( a * Math.pow( 2, 10 * ( k -= 1 ) ) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) ); - - }, - - Out: function ( k ) { - - var s, a = 0.1, p = 0.4; - if ( k === 0 ) return 0; - if ( k === 1 ) return 1; - if ( !a || a < 1 ) { a = 1; s = p / 4; } - else s = p * Math.asin( 1 / a ) / ( 2 * Math.PI ); - return ( a * Math.pow( 2, - 10 * k) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) + 1 ); - - }, - - InOut: function ( k ) { - - var s, a = 0.1, p = 0.4; - if ( k === 0 ) return 0; - if ( k === 1 ) return 1; - if ( !a || a < 1 ) { a = 1; s = p / 4; } - else s = p * Math.asin( 1 / a ) / ( 2 * Math.PI ); - 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; - - } - - }, - - Back: { - - In: function ( k ) { - - var s = 1.70158; - return k * k * ( ( s + 1 ) * k - s ); - - }, - - Out: function ( k ) { - - var s = 1.70158; - return --k * k * ( ( s + 1 ) * k + s ) + 1; - - }, - - InOut: 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 ); - - } - - }, - - Bounce: { - - In: function ( k ) { - - return 1 - TWEEN.Easing.Bounce.Out( 1 - k ); - - }, - - Out: function ( k ) { - - if ( k < ( 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; - - } - - }, - - InOut: function ( k ) { - - if ( k < 0.5 ) return TWEEN.Easing.Bounce.In( k * 2 ) * 0.5; - return TWEEN.Easing.Bounce.Out( k * 2 - 1 ) * 0.5 + 0.5; - - } - - } - -}; - -TWEEN.Interpolation = { - - Linear: function ( v, k ) { - - var m = v.length - 1, f = m * k, i = Math.floor( f ), fn = TWEEN.Interpolation.Utils.Linear; - - if ( k < 0 ) return fn( v[ 0 ], v[ 1 ], f ); - if ( k > 1 ) return fn( v[ m ], v[ m - 1 ], m - f ); - - return fn( v[ i ], v[ i + 1 > m ? m : i + 1 ], f - i ); - - }, - - Bezier: function ( v, k ) { - - var b = 0, n = v.length - 1, pw = Math.pow, bn = TWEEN.Interpolation.Utils.Bernstein, i; - - for ( i = 0; i <= n; i++ ) { - b += pw( 1 - k, n - i ) * pw( k, i ) * v[ i ] * bn( n, i ); - } - - return b; - - }, - - CatmullRom: function ( v, k ) { - - var m = v.length - 1, f = m * k, i = Math.floor( f ), fn = TWEEN.Interpolation.Utils.CatmullRom; - - if ( v[ 0 ] === v[ m ] ) { - - if ( k < 0 ) i = Math.floor( f = m * ( 1 + k ) ); - - return fn( v[ ( i - 1 + m ) % m ], v[ i ], v[ ( i + 1 ) % m ], v[ ( i + 2 ) % m ], f - i ); - - } else { - - if ( k < 0 ) return v[ 0 ] - ( fn( v[ 0 ], v[ 0 ], v[ 1 ], v[ 1 ], -f ) - v[ 0 ] ); - if ( k > 1 ) return v[ m ] - ( fn( v[ m ], v[ m ], v[ m - 1 ], v[ m - 1 ], f - m ) - v[ m ] ); - - return fn( v[ i ? i - 1 : 0 ], v[ i ], v[ m < i + 1 ? m : i + 1 ], v[ m < i + 2 ? m : i + 2 ], f - i ); - - } - - }, - - Utils: { - - Linear: function ( p0, p1, t ) { - - return ( p1 - p0 ) * t + p0; - - }, - - Bernstein: function ( n , i ) { - - var fc = TWEEN.Interpolation.Utils.Factorial; - return fc( n ) / fc( i ) / fc( n - i ); - - }, - - Factorial: ( function () { - - var a = [ 1 ]; - - return function ( n ) { - - var s = 1, i; - if ( a[ n ] ) return a[ n ]; - for ( i = n; i > 1; i-- ) s *= i; - return a[ n ] = s; - - }; - - } )(), - - CatmullRom: function ( p0, p1, p2, p3, t ) { - - var v0 = ( p2 - p0 ) * 0.5, v1 = ( p3 - p1 ) * 0.5, t2 = t * t, t3 = t * t2; - return ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1; - - } - - } - -}; diff --git a/todo/oldphysics/Manager.js b/todo/oldphysics/Manager.js deleted file mode 100644 index 3cc9fd2c..00000000 --- a/todo/oldphysics/Manager.js +++ /dev/null @@ -1,29 +0,0 @@ -var Phaser; -(function (Phaser) { - ///- /** - * Phaser - Physics Manager - * - * Eventually this will handle switching between the default ArcadePhysics manager or the new AdvancedPhysics manager. - * For now we direct everything through ArcadePhysics. - */ - (function (Physics) { - var Manager = (function () { - function Manager(game) { - this.game = game; - this.arcade = new Phaser.Physics.ArcadePhysics(this.game, this.game.stage.width, this.game.stage.height); - this.gravity = this.arcade.gravity; - this.bounds = this.arcade.bounds; - } - Manager.prototype.update = /** - * Called by the main Game.loop - */ - function () { - //this.arcade.updateMotion - }; - return Manager; - })(); - Physics.Manager = Manager; - })(Phaser.Physics || (Phaser.Physics = {})); - var Physics = Phaser.Physics; -})(Phaser || (Phaser = {})); diff --git a/todo/oldphysics/Manager.ts b/todo/oldphysics/Manager.ts deleted file mode 100644 index 8077069a..00000000 --- a/todo/oldphysics/Manager.ts +++ /dev/null @@ -1,49 +0,0 @@ -/// - -/** -* Phaser - Physics Manager -* -* Eventually this will handle switching between the default ArcadePhysics manager or the new AdvancedPhysics manager. -* For now we direct everything through ArcadePhysics. -*/ - -module Phaser.Physics { - - export class Manager { - - constructor(game: Game) { - - this.game = game; - - this.arcade = new Phaser.Physics.ArcadePhysics(this.game, this.game.stage.width, this.game.stage.height); - - this.gravity = this.arcade.gravity; - this.bounds = this.arcade.bounds; - - } - - /** - * Local reference to Game. - */ - public game: Game; - - /** - * Instance of the ArcadePhysics manager. - */ - public arcade: Phaser.Physics.ArcadePhysics; - - public gravity: Vec2; - public bounds: Rectangle; - - /** - * Called by the main Game.loop - */ - public update() { - - //this.arcade.updateMotion - - } - - } - -} \ No newline at end of file diff --git a/todo/oldphysics/arcade/ArcadePhysics.js b/todo/oldphysics/arcade/ArcadePhysics.js deleted file mode 100644 index f320a01b..00000000 --- a/todo/oldphysics/arcade/ArcadePhysics.js +++ /dev/null @@ -1,949 +0,0 @@ -var Phaser; -(function (Phaser) { - /// - /// - /// - /// - /// - /** - * Phaser - ArcadePhysics Manager - * - */ - (function (Physics) { - var ArcadePhysics = (function () { - function ArcadePhysics(game, width, height) { - this._length = 0; - /** - * @type {number} - */ - this.worldDivisions = 6; - this.game = game; - this.gravity = new Phaser.Vec2(); - this.drag = new Phaser.Vec2(); - this.bounce = new Phaser.Vec2(); - this.angularDrag = 0; - this.bounds = new Phaser.Rectangle(0, 0, width, height); - this._distance = new Phaser.Vec2(); - this._tangent = new Phaser.Vec2(); - //this.members = new Group(game); - } - ArcadePhysics.OVERLAP_BIAS = 4; - ArcadePhysics.TILE_OVERLAP = false; - ArcadePhysics.prototype.updateMotion = /* - public update() { - - this._length = this._objects.length; - - for (var i = 0; i < this._length; i++) - { - if (this._objects[i]) - { - this._objects[i].preUpdate(); - this.updateMotion(this._objects[i]); - this.collideWorld(this._objects[i]); - - for (var x = 0; x < this._length; x++) - { - if (this._objects[x] && this._objects[x] !== this._objects[i]) - { - //this.collideShapes(this._objects[i], this._objects[x]); - var r = this.NEWseparate(this._objects[i], this._objects[x]); - //console.log('sep', r); - } - } - - } - } - - } - - public render() { - - // iterate through the objects here, updating and colliding - for (var i = 0; i < this._length; i++) - { - if (this._objects[i]) - { - this._objects[i].render(this.game.stage.context); - } - } - - } - */ - function (body) { - if(body.type == Phaser.Types.BODY_DISABLED) { - return; - } - this._velocityDelta = (this.computeVelocity(body.angularVelocity, body.gravity.x, body.angularAcceleration, body.angularDrag, body.maxAngular) - body.angularVelocity) / 2; - body.angularVelocity += this._velocityDelta; - body.sprite.transform.rotation += body.angularVelocity * this.game.time.elapsed; - body.angularVelocity += this._velocityDelta; - this._velocityDelta = (this.computeVelocity(body.velocity.x, body.gravity.x, body.acceleration.x, body.drag.x) - body.velocity.x) / 2; - body.velocity.x += this._velocityDelta; - this._delta = body.velocity.x * this.game.time.elapsed; - body.velocity.x += this._velocityDelta; - //body.position.x += this._delta; - body.sprite.x += this._delta; - this._velocityDelta = (this.computeVelocity(body.velocity.y, body.gravity.y, body.acceleration.y, body.drag.y) - body.velocity.y) / 2; - body.velocity.y += this._velocityDelta; - this._delta = body.velocity.y * this.game.time.elapsed; - body.velocity.y += this._velocityDelta; - //body.position.y += this._delta; - body.sprite.y += this._delta; - }; - ArcadePhysics.prototype.computeVelocity = /** - * A tween-like function that takes a starting velocity and some other factors and returns an altered velocity. - * - * @param {number} Velocity Any component of velocity (e.g. 20). - * @param {number} Acceleration Rate at which the velocity is changing. - * @param {number} Drag Really kind of a deceleration, this is how much the velocity changes if Acceleration is not set. - * @param {number} Max An absolute value cap for the velocity. - * - * @return {number} The altered Velocity value. - */ - function (velocity, gravity, acceleration, drag, max) { - if (typeof gravity === "undefined") { gravity = 0; } - if (typeof acceleration === "undefined") { acceleration = 0; } - if (typeof drag === "undefined") { drag = 0; } - if (typeof max === "undefined") { max = 10000; } - if(acceleration !== 0) { - velocity += (acceleration + gravity) * this.game.time.elapsed; - } else if(drag !== 0) { - this._drag = drag * this.game.time.elapsed; - if(velocity - this._drag > 0) { - velocity = velocity - this._drag; - } else if(velocity + this._drag < 0) { - velocity += this._drag; - } else { - velocity = 0; - } - velocity += gravity; - } - if((velocity != 0) && (max != 10000)) { - if(velocity > max) { - velocity = max; - } else if(velocity < -max) { - velocity = -max; - } - } - return velocity; - }; - ArcadePhysics.prototype.separate = /** - * The core Collision separation method. - * @param body1 The first Physics.Body to separate - * @param body2 The second Physics.Body to separate - * @returns {boolean} Returns true if the bodies were separated, otherwise false. - */ - function (body1, body2) { - this._separatedX = this.separateBodyX(body1, body2); - this._separatedY = this.separateBodyY(body1, body2); - return this._separatedX || this._separatedY; - }; - ArcadePhysics.prototype.checkHullIntersection = function (body1, body2) { - return ((body1.hullX + body1.hullWidth > body2.hullX) && (body1.hullX < body2.hullX + body2.hullWidth) && (body1.hullY + body1.hullHeight > body2.hullY) && (body1.hullY < body2.hullY + body2.hullHeight)); - }; - ArcadePhysics.prototype.separateBodyX = /** - * Separates the two objects on their x axis - * @param object1 The first GameObject to separate - * @param object2 The second GameObject to separate - * @returns {boolean} Whether the objects in fact touched and were separated along the X axis. - */ - function (body1, body2) { - // Can't separate two disabled or static objects - if((body1.type == Phaser.Types.BODY_DISABLED || body1.type == Phaser.Types.BODY_STATIC) && (body2.type == Phaser.Types.BODY_DISABLED || body2.type == Phaser.Types.BODY_STATIC)) { - return false; - } - // First, get the two object deltas - this._overlap = 0; - if(body1.deltaX != body2.deltaX) { - if(Phaser.RectangleUtils.intersects(body1.bounds, body2.bounds)) { - this._maxOverlap = body1.deltaXAbs + body2.deltaXAbs + ArcadePhysics.OVERLAP_BIAS; - // If they did overlap (and can), figure out by how much and flip the corresponding flags - if(body1.deltaX > body2.deltaX) { - this._overlap = body1.bounds.right - body2.bounds.x; - if((this._overlap > this._maxOverlap) || !(body1.allowCollisions & Phaser.Types.RIGHT) || !(body2.allowCollisions & Phaser.Types.LEFT)) { - this._overlap = 0; - } else { - body1.touching |= Phaser.Types.RIGHT; - body2.touching |= Phaser.Types.LEFT; - } - } else if(body1.deltaX < body2.deltaX) { - this._overlap = body1.bounds.x - body2.bounds.width - body2.bounds.x; - if((-this._overlap > this._maxOverlap) || !(body1.allowCollisions & Phaser.Types.LEFT) || !(body2.allowCollisions & Phaser.Types.RIGHT)) { - this._overlap = 0; - } else { - body1.touching |= Phaser.Types.LEFT; - body2.touching |= Phaser.Types.RIGHT; - } - } - } - } - // Then adjust their positions and velocities accordingly (if there was any overlap) - if(this._overlap != 0) { - this._obj1Velocity = body1.velocity.x; - this._obj2Velocity = body2.velocity.x; - /** - * Dynamic = gives and receives impacts - * Static = gives but doesn't receive impacts, cannot be moved by physics - * Kinematic = gives impacts, but never receives, can be moved by physics - */ - // 2 dynamic bodies will exchange velocities - if(body1.type == Phaser.Types.BODY_DYNAMIC && body2.type == Phaser.Types.BODY_DYNAMIC) { - this._overlap *= 0.5; - body1.position.x = body1.position.x - this._overlap; - body2.position.x += this._overlap; - this._obj1NewVelocity = Math.sqrt((this._obj2Velocity * this._obj2Velocity * body2.mass) / body1.mass) * ((this._obj2Velocity > 0) ? 1 : -1); - this._obj2NewVelocity = Math.sqrt((this._obj1Velocity * this._obj1Velocity * body1.mass) / body2.mass) * ((this._obj1Velocity > 0) ? 1 : -1); - this._average = (this._obj1NewVelocity + this._obj2NewVelocity) * 0.5; - this._obj1NewVelocity -= this._average; - this._obj2NewVelocity -= this._average; - body1.velocity.x = this._average + this._obj1NewVelocity * body1.bounce.x; - body2.velocity.x = this._average + this._obj2NewVelocity * body2.bounce.x; - } else if(body2.type != Phaser.Types.BODY_DYNAMIC) { - // Body 2 is Static or Kinematic - this._overlap *= 2; - body1.position.x -= this._overlap; - body1.velocity.x = this._obj2Velocity - this._obj1Velocity * body1.bounce.x; - } else if(body1.type != Phaser.Types.BODY_DYNAMIC) { - // Body 1 is Static or Kinematic - this._overlap *= 2; - body2.position.x += this._overlap; - body2.velocity.x = this._obj1Velocity - this._obj2Velocity * body2.bounce.x; - } - return true; - } else { - return false; - } - }; - ArcadePhysics.prototype.separateBodyY = /** - * Separates the two objects on their y axis - * @param object1 The first GameObject to separate - * @param object2 The second GameObject to separate - * @returns {boolean} Whether the objects in fact touched and were separated along the Y axis. - */ - function (body1, body2) { - // Can't separate two immovable objects - if((body1.type == Phaser.Types.BODY_DISABLED || body1.type == Phaser.Types.BODY_STATIC) && (body2.type == Phaser.Types.BODY_DISABLED || body2.type == Phaser.Types.BODY_STATIC)) { - return false; - } - // First, get the two object deltas - this._overlap = 0; - if(body1.deltaY != body2.deltaY) { - if(Phaser.RectangleUtils.intersects(body1.bounds, body2.bounds)) { - // This is the only place to use the DeltaAbs values - this._maxOverlap = body1.deltaYAbs + body2.deltaYAbs + ArcadePhysics.OVERLAP_BIAS; - // If they did overlap (and can), figure out by how much and flip the corresponding flags - if(body1.deltaY > body2.deltaY) { - this._overlap = body1.bounds.bottom - body2.bounds.y; - if((this._overlap > this._maxOverlap) || !(body1.allowCollisions & Phaser.Types.DOWN) || !(body2.allowCollisions & Phaser.Types.UP)) { - this._overlap = 0; - } else { - body1.touching |= Phaser.Types.DOWN; - body2.touching |= Phaser.Types.UP; - } - } else if(body1.deltaY < body2.deltaY) { - this._overlap = body1.bounds.y - body2.bounds.height - body2.bounds.y; - if((-this._overlap > this._maxOverlap) || !(body1.allowCollisions & Phaser.Types.UP) || !(body2.allowCollisions & Phaser.Types.DOWN)) { - this._overlap = 0; - } else { - body1.touching |= Phaser.Types.UP; - body2.touching |= Phaser.Types.DOWN; - } - } - } - } - // Then adjust their positions and velocities accordingly (if there was any overlap) - if(this._overlap != 0) { - this._obj1Velocity = body1.velocity.y; - this._obj2Velocity = body2.velocity.y; - /** - * Dynamic = gives and receives impacts - * Static = gives but doesn't receive impacts, cannot be moved by physics - * Kinematic = gives impacts, but never receives, can be moved by physics - */ - if(body1.type == Phaser.Types.BODY_DYNAMIC && body2.type == Phaser.Types.BODY_DYNAMIC) { - this._overlap *= 0.5; - body1.position.y = body1.position.y - this._overlap; - body2.position.y += this._overlap; - this._obj1NewVelocity = Math.sqrt((this._obj2Velocity * this._obj2Velocity * body2.mass) / body1.mass) * ((this._obj2Velocity > 0) ? 1 : -1); - this._obj2NewVelocity = Math.sqrt((this._obj1Velocity * this._obj1Velocity * body1.mass) / body2.mass) * ((this._obj1Velocity > 0) ? 1 : -1); - var average = (this._obj1NewVelocity + this._obj2NewVelocity) * 0.5; - this._obj1NewVelocity -= average; - this._obj2NewVelocity -= average; - body1.velocity.y = average + this._obj1NewVelocity * body1.bounce.y; - body2.velocity.y = average + this._obj2NewVelocity * body2.bounce.y; - } else if(body2.type != Phaser.Types.BODY_DYNAMIC) { - this._overlap *= 2; - body1.position.y -= this._overlap; - body1.velocity.y = this._obj2Velocity - this._obj1Velocity * body1.bounce.y; - // This is special case code that handles things like horizontal moving platforms you can ride - //if (body2.parent.active && body2.moves && (body1.deltaY > body2.deltaY)) - if(body2.sprite.active && (body1.deltaY > body2.deltaY)) { - body1.position.x += body2.position.x - body2.oldPosition.x; - } - } else if(body1.type != Phaser.Types.BODY_DYNAMIC) { - this._overlap *= 2; - body2.position.y += this._overlap; - body2.velocity.y = this._obj1Velocity - this._obj2Velocity * body2.bounce.y; - // This is special case code that handles things like horizontal moving platforms you can ride - //if (object1.active && body1.moves && (body1.deltaY < body2.deltaY)) - if(body1.sprite.active && (body1.deltaY < body2.deltaY)) { - body2.position.x += body1.position.x - body1.oldPosition.x; - } - } - return true; - } else { - return false; - } - }; - ArcadePhysics.prototype.overlap = /* - private TILEseparate(shapeA: IPhysicsShape, shapeB: IPhysicsShape, distance: Vec2, tangent: Vec2) { - - if (tangent.x == 1) - { - console.log('1 The left side of ShapeA hit the right side of ShapeB', Math.floor(distance.x)); - shapeA.physics.touching |= Phaser.Types.LEFT; - shapeB.physics.touching |= Phaser.Types.RIGHT; - } - else if (tangent.x == -1) - { - console.log('2 The right side of ShapeA hit the left side of ShapeB', Math.floor(distance.x)); - shapeA.physics.touching |= Phaser.Types.RIGHT; - shapeB.physics.touching |= Phaser.Types.LEFT; - } - - if (tangent.y == 1) - { - console.log('3 The top of ShapeA hit the bottom of ShapeB', Math.floor(distance.y)); - shapeA.physics.touching |= Phaser.Types.UP; - shapeB.physics.touching |= Phaser.Types.DOWN; - } - else if (tangent.y == -1) - { - console.log('4 The bottom of ShapeA hit the top of ShapeB', Math.floor(distance.y)); - shapeA.physics.touching |= Phaser.Types.DOWN; - shapeB.physics.touching |= Phaser.Types.UP; - } - - - // only apply collision response forces if the object is travelling into, and not out of, the collision - var dot = Vec2Utils.dot(shapeA.physics.velocity, tangent); - - if (dot < 0) - { - console.log('in to', dot); - - // Apply horizontal bounce - if (shapeA.physics.bounce.x > 0) - { - shapeA.physics.velocity.x *= -(shapeA.physics.bounce.x); - } - else - { - shapeA.physics.velocity.x = 0; - } - // Apply horizontal bounce - if (shapeA.physics.bounce.y > 0) - { - shapeA.physics.velocity.y *= -(shapeA.physics.bounce.y); - } - else - { - shapeA.physics.velocity.y = 0; - } - } - else - { - console.log('out of', dot); - } - - shapeA.position.x += Math.floor(distance.x); - //shapeA.bounds.x += Math.floor(distance.x); - - shapeA.position.y += Math.floor(distance.y); - //shapeA.bounds.y += distance.y; - - console.log('------------------------------------------------'); - - } - - private collideWorld(shape:IPhysicsShape) { - - // Collide on the x-axis - this._distance.x = shape.world.bounds.x - (shape.position.x - shape.bounds.halfWidth); - - if (0 < this._distance.x) - { - // Hit Left - this._tangent.setTo(1, 0); - this.separateXWall(shape, this._distance, this._tangent); - } - else - { - this._distance.x = (shape.position.x + shape.bounds.halfWidth) - shape.world.bounds.right; - - if (0 < this._distance.x) - { - // Hit Right - this._tangent.setTo(-1, 0); - this._distance.reverse(); - this.separateXWall(shape, this._distance, this._tangent); - } - } - - // Collide on the y-axis - this._distance.y = shape.world.bounds.y - (shape.position.y - shape.bounds.halfHeight); - - if (0 < this._distance.y) - { - // Hit Top - this._tangent.setTo(0, 1); - this.separateYWall(shape, this._distance, this._tangent); - } - else - { - this._distance.y = (shape.position.y + shape.bounds.halfHeight) - shape.world.bounds.bottom; - - if (0 < this._distance.y) - { - // Hit Bottom - this._tangent.setTo(0, -1); - this._distance.reverse(); - this.separateYWall(shape, this._distance, this._tangent); - } - } - - } - - private separateX(shapeA: IPhysicsShape, shapeB: IPhysicsShape, distance: Vec2, tangent: Vec2) { - - if (tangent.x == 1) - { - console.log('The left side of ShapeA hit the right side of ShapeB', distance.x); - shapeA.physics.touching |= Phaser.Types.LEFT; - shapeB.physics.touching |= Phaser.Types.RIGHT; - } - else - { - console.log('The right side of ShapeA hit the left side of ShapeB', distance.x); - shapeA.physics.touching |= Phaser.Types.RIGHT; - shapeB.physics.touching |= Phaser.Types.LEFT; - } - - // collision edges - //shapeA.oH = tangent.x; - - // only apply collision response forces if the object is travelling into, and not out of, the collision - if (Vec2Utils.dot(shapeA.physics.velocity, tangent) < 0) - { - // Apply horizontal bounce - if (shapeA.physics.bounce.x > 0) - { - shapeA.physics.velocity.x *= -(shapeA.physics.bounce.x); - } - else - { - shapeA.physics.velocity.x = 0; - } - } - - shapeA.position.x += distance.x; - shapeA.bounds.x += distance.x; - - } - - private separateY(shapeA: IPhysicsShape, shapeB: IPhysicsShape, distance: Vec2, tangent: Vec2) { - - if (tangent.y == 1) - { - console.log('The top of ShapeA hit the bottom of ShapeB', distance.y); - shapeA.physics.touching |= Phaser.Types.UP; - shapeB.physics.touching |= Phaser.Types.DOWN; - } - else - { - console.log('The bottom of ShapeA hit the top of ShapeB', distance.y); - shapeA.physics.touching |= Phaser.Types.DOWN; - shapeB.physics.touching |= Phaser.Types.UP; - } - - // collision edges - //shapeA.oV = tangent.y; - - // only apply collision response forces if the object is travelling into, and not out of, the collision - if (Vec2Utils.dot(shapeA.physics.velocity, tangent) < 0) - { - // Apply horizontal bounce - if (shapeA.physics.bounce.y > 0) - { - shapeA.physics.velocity.y *= -(shapeA.physics.bounce.y); - } - else - { - shapeA.physics.velocity.y = 0; - } - } - - shapeA.position.y += distance.y; - shapeA.bounds.y += distance.y; - - } - - private separateXWall(shapeA: IPhysicsShape, distance: Vec2, tangent: Vec2) { - - if (tangent.x == 1) - { - console.log('The left side of ShapeA hit the right side of ShapeB', distance.x); - shapeA.physics.touching |= Phaser.Types.LEFT; - } - else - { - console.log('The right side of ShapeA hit the left side of ShapeB', distance.x); - shapeA.physics.touching |= Phaser.Types.RIGHT; - } - - // collision edges - //shapeA.oH = tangent.x; - - // only apply collision response forces if the object is travelling into, and not out of, the collision - if (Vec2Utils.dot(shapeA.physics.velocity, tangent) < 0) - { - // Apply horizontal bounce - if (shapeA.physics.bounce.x > 0) - { - shapeA.physics.velocity.x *= -(shapeA.physics.bounce.x); - } - else - { - shapeA.physics.velocity.x = 0; - } - } - - shapeA.position.x += distance.x; - - } - - private separateYWall(shapeA: IPhysicsShape, distance: Vec2, tangent: Vec2) { - - if (tangent.y == 1) - { - console.log('The top of ShapeA hit the bottom of ShapeB', distance.y); - shapeA.physics.touching |= Phaser.Types.UP; - } - else - { - console.log('The bottom of ShapeA hit the top of ShapeB', distance.y); - shapeA.physics.touching |= Phaser.Types.DOWN; - } - - // collision edges - //shapeA.oV = tangent.y; - - // only apply collision response forces if the object is travelling into, and not out of, the collision - if (Vec2Utils.dot(shapeA.physics.velocity, tangent) < 0) - { - // Apply horizontal bounce - if (shapeA.physics.bounce.y > 0) - { - shapeA.physics.velocity.y *= -(shapeA.physics.bounce.y); - } - else - { - shapeA.physics.velocity.y = 0; - } - } - - shapeA.position.y += distance.y; - - } - */ - /** - * Checks for overlaps between two objects using the world QuadTree. Can be Sprite vs. Sprite, Sprite vs. Group or Group vs. Group. - * Note: Does not take the objects scrollFactor into account. All overlaps are check in world space. - * @param object1 The first Sprite or Group to check. If null the world.group is used. - * @param object2 The second Sprite or Group to check. - * @param notifyCallback A callback function that is called if the objects overlap. The two objects will be passed to this function in the same order in which you passed them to Collision.overlap. - * @param processCallback A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then notifyCallback will only be called if processCallback returns true. - * @param context The context in which the callbacks will be called - * @returns {boolean} true if the objects overlap, otherwise false. - */ - function (object1, object2, notifyCallback, processCallback, context) { - if (typeof object1 === "undefined") { object1 = null; } - if (typeof object2 === "undefined") { object2 = null; } - if (typeof notifyCallback === "undefined") { notifyCallback = null; } - if (typeof processCallback === "undefined") { processCallback = null; } - if (typeof context === "undefined") { context = null; } - /* - if (object1 == null) - { - object1 = this.game.world.group; - } - - if (object2 == object1) - { - object2 = null; - } - - QuadTree.divisions = this.worldDivisions; - - this._quadTree = new Phaser.QuadTree(this, this.bounds.x, this.bounds.y, this.bounds.width, this.bounds.height); - - this._quadTree.load(object1, object2, notifyCallback, processCallback, context); - - this._quadTreeResult = this._quadTree.execute(); - - console.log('over', this._quadTreeResult); - - this._quadTree.destroy(); - - this._quadTree = null; - - return this._quadTreeResult; - */ - return false; - }; - ArcadePhysics.prototype.separateTile = /** - * Collision resolution specifically for GameObjects vs. Tiles. - * @param object The GameObject to separate - * @param tile The Tile to separate - * @returns {boolean} Whether the objects in fact touched and were separated - */ - function (object, x, y, width, height, mass, collideLeft, collideRight, collideUp, collideDown, separateX, separateY) { - //var separatedX: bool = this.separateTileX(object, x, y, width, height, mass, collideLeft, collideRight, separateX); - //var separatedY: bool = this.separateTileY(object, x, y, width, height, mass, collideUp, collideDown, separateY); - //return separatedX || separatedY; - return false; - }; - return ArcadePhysics; - })(); - Physics.ArcadePhysics = ArcadePhysics; - /** - * Separates the two objects on their x axis - * @param object The GameObject to separate - * @param tile The Tile to separate - * @returns {boolean} Whether the objects in fact touched and were separated along the X axis. - */ - /* - public separateTileX(object:Sprite, x: number, y: number, width: number, height: number, mass: number, collideLeft: bool, collideRight: bool, separate: bool): bool { - - // Can't separate two immovable objects (tiles are always immovable) - if (object.immovable) - { - return false; - } - - // First, get the object delta - var overlap: number = 0; - var objDelta: number = object.x - object.last.x; - //var objDelta: number = object.collisionMask.deltaX; - - if (objDelta != 0) - { - // Check if the X hulls actually overlap - var objDeltaAbs: number = (objDelta > 0) ? objDelta : -objDelta; - //var objDeltaAbs: number = object.collisionMask.deltaXAbs; - var objBounds: Rectangle = new Rectangle(object.x - ((objDelta > 0) ? objDelta : 0), object.last.y, object.width + ((objDelta > 0) ? objDelta : -objDelta), object.height); - - if ((objBounds.x + objBounds.width > x) && (objBounds.x < x + width) && (objBounds.y + objBounds.height > y) && (objBounds.y < y + height)) - { - var maxOverlap: number = objDeltaAbs + Collision.OVERLAP_BIAS; - - // If they did overlap (and can), figure out by how much and flip the corresponding flags - if (objDelta > 0) - { - overlap = object.x + object.width - x; - - if ((overlap > maxOverlap) || !(object.allowCollisions & Collision.RIGHT) || collideLeft == false) - { - overlap = 0; - } - else - { - object.touching |= Collision.RIGHT; - } - } - else if (objDelta < 0) - { - overlap = object.x - width - x; - - if ((-overlap > maxOverlap) || !(object.allowCollisions & Collision.LEFT) || collideRight == false) - { - overlap = 0; - } - else - { - object.touching |= Collision.LEFT; - } - - } - - } - } - - // Then adjust their positions and velocities accordingly (if there was any overlap) - if (overlap != 0) - { - if (separate == true) - { - //console.log(' - object.x = object.x - overlap; - object.velocity.x = -(object.velocity.x * object.elasticity); - } - - Collision.TILE_OVERLAP = true; - return true; - } - else - { - return false; - } - - } - */ - /** - * Separates the two objects on their y axis - * @param object The first GameObject to separate - * @param tile The second GameObject to separate - * @returns {boolean} Whether the objects in fact touched and were separated along the Y axis. - */ - /* - public separateTileY(object: Sprite, x: number, y: number, width: number, height: number, mass: number, collideUp: bool, collideDown: bool, separate: bool): bool { - - // Can't separate two immovable objects (tiles are always immovable) - if (object.immovable) - { - return false; - } - - // First, get the two object deltas - var overlap: number = 0; - var objDelta: number = object.y - object.last.y; - - if (objDelta != 0) - { - // Check if the Y hulls actually overlap - var objDeltaAbs: number = (objDelta > 0) ? objDelta : -objDelta; - var objBounds: Rectangle = new Rectangle(object.x, object.y - ((objDelta > 0) ? objDelta : 0), object.width, object.height + objDeltaAbs); - - if ((objBounds.x + objBounds.width > x) && (objBounds.x < x + width) && (objBounds.y + objBounds.height > y) && (objBounds.y < y + height)) - { - var maxOverlap: number = objDeltaAbs + Collision.OVERLAP_BIAS; - - // If they did overlap (and can), figure out by how much and flip the corresponding flags - if (objDelta > 0) - { - overlap = object.y + object.height - y; - - if ((overlap > maxOverlap) || !(object.allowCollisions & Collision.DOWN) || collideUp == false) - { - overlap = 0; - } - else - { - object.touching |= Collision.DOWN; - } - } - else if (objDelta < 0) - { - overlap = object.y - height - y; - - if ((-overlap > maxOverlap) || !(object.allowCollisions & Collision.UP) || collideDown == false) - { - overlap = 0; - } - else - { - object.touching |= Collision.UP; - } - } - } - } - - // TODO - with super low velocities you get lots of stuttering, set some kind of base minimum here - - // Then adjust their positions and velocities accordingly (if there was any overlap) - if (overlap != 0) - { - if (separate == true) - { - object.y = object.y - overlap; - object.velocity.y = -(object.velocity.y * object.elasticity); - } - - Collision.TILE_OVERLAP = true; - return true; - } - else - { - return false; - } - } - */ - /** - * Separates the two objects on their x axis - * @param object The GameObject to separate - * @param tile The Tile to separate - * @returns {boolean} Whether the objects in fact touched and were separated along the X axis. - */ - /* - public static NEWseparateTileX(object:Sprite, x: number, y: number, width: number, height: number, mass: number, collideLeft: bool, collideRight: bool, separate: bool): bool { - - // Can't separate two immovable objects (tiles are always immovable) - if (object.immovable) - { - return false; - } - - // First, get the object delta - var overlap: number = 0; - - if (object.collisionMask.deltaX != 0) - { - // Check if the X hulls actually overlap - //var objDeltaAbs: number = (objDelta > 0) ? objDelta : -objDelta; - //var objBounds: Rectangle = new Rectangle(object.x - ((objDelta > 0) ? objDelta : 0), object.last.y, object.width + ((objDelta > 0) ? objDelta : -objDelta), object.height); - - //if ((objBounds.x + objBounds.width > x) && (objBounds.x < x + width) && (objBounds.y + objBounds.height > y) && (objBounds.y < y + height)) - if (object.collisionMask.intersectsRaw(x, x + width, y, y + height)) - { - var maxOverlap: number = object.collisionMask.deltaXAbs + Collision.OVERLAP_BIAS; - - // If they did overlap (and can), figure out by how much and flip the corresponding flags - if (object.collisionMask.deltaX > 0) - { - //overlap = object.x + object.width - x; - overlap = object.collisionMask.right - x; - - if ((overlap > maxOverlap) || !(object.allowCollisions & Collision.RIGHT) || collideLeft == false) - { - overlap = 0; - } - else - { - object.touching |= Collision.RIGHT; - } - } - else if (object.collisionMask.deltaX < 0) - { - //overlap = object.x - width - x; - overlap = object.collisionMask.x - width - x; - - if ((-overlap > maxOverlap) || !(object.allowCollisions & Collision.LEFT) || collideRight == false) - { - overlap = 0; - } - else - { - object.touching |= Collision.LEFT; - } - - } - - } - } - - // Then adjust their positions and velocities accordingly (if there was any overlap) - if (overlap != 0) - { - if (separate == true) - { - object.x = object.x - overlap; - object.velocity.x = -(object.velocity.x * object.elasticity); - } - - Collision.TILE_OVERLAP = true; - return true; - } - else - { - return false; - } - - } - */ - /** - * Separates the two objects on their y axis - * @param object The first GameObject to separate - * @param tile The second GameObject to separate - * @returns {boolean} Whether the objects in fact touched and were separated along the Y axis. - */ - /* - public NEWseparateTileY(object: Sprite, x: number, y: number, width: number, height: number, mass: number, collideUp: bool, collideDown: bool, separate: bool): bool { - - // Can't separate two immovable objects (tiles are always immovable) - if (object.immovable) - { - return false; - } - - // First, get the two object deltas - var overlap: number = 0; - //var objDelta: number = object.y - object.last.y; - - if (object.collisionMask.deltaY != 0) - { - // Check if the Y hulls actually overlap - //var objDeltaAbs: number = (objDelta > 0) ? objDelta : -objDelta; - //var objBounds: Rectangle = new Rectangle(object.x, object.y - ((objDelta > 0) ? objDelta : 0), object.width, object.height + objDeltaAbs); - - //if ((objBounds.x + objBounds.width > x) && (objBounds.x < x + width) && (objBounds.y + objBounds.height > y) && (objBounds.y < y + height)) - if (object.collisionMask.intersectsRaw(x, x + width, y, y + height)) - { - //var maxOverlap: number = objDeltaAbs + Collision.OVERLAP_BIAS; - var maxOverlap: number = object.collisionMask.deltaYAbs + Collision.OVERLAP_BIAS; - - // If they did overlap (and can), figure out by how much and flip the corresponding flags - if (object.collisionMask.deltaY > 0) - { - //overlap = object.y + object.height - y; - overlap = object.collisionMask.bottom - y; - - if ((overlap > maxOverlap) || !(object.allowCollisions & Collision.DOWN) || collideUp == false) - { - overlap = 0; - } - else - { - object.touching |= Collision.DOWN; - } - } - else if (object.collisionMask.deltaY < 0) - { - //overlap = object.y - height - y; - overlap = object.collisionMask.y - height - y; - - if ((-overlap > maxOverlap) || !(object.allowCollisions & Collision.UP) || collideDown == false) - { - overlap = 0; - } - else - { - object.touching |= Collision.UP; - } - } - } - } - - // TODO - with super low velocities you get lots of stuttering, set some kind of base minimum here - - // Then adjust their positions and velocities accordingly (if there was any overlap) - if (overlap != 0) - { - if (separate == true) - { - object.y = object.y - overlap; - object.velocity.y = -(object.velocity.y * object.elasticity); - } - - Collision.TILE_OVERLAP = true; - return true; - } - else - { - return false; - } - } - */ - })(Phaser.Physics || (Phaser.Physics = {})); - var Physics = Phaser.Physics; -})(Phaser || (Phaser = {})); diff --git a/todo/oldphysics/arcade/ArcadePhysics.ts b/todo/oldphysics/arcade/ArcadePhysics.ts deleted file mode 100644 index ce88047d..00000000 --- a/todo/oldphysics/arcade/ArcadePhysics.ts +++ /dev/null @@ -1,1118 +0,0 @@ -/// -/// -/// -/// -/// - -/** -* Phaser - ArcadePhysics Manager -* -*/ - -module Phaser.Physics { - - export class ArcadePhysics { - - constructor(game: Game, width: number, height: number) { - - this.game = game; - - this.gravity = new Vec2; - this.drag = new Vec2; - this.bounce = new Vec2; - this.angularDrag = 0; - - this.bounds = new Rectangle(0, 0, width, height); - - this._distance = new Vec2; - this._tangent = new Vec2; - - //this.members = new Group(game); - - } - - /** - * Local reference to Game. - */ - public game: Game; - - /** - * Physics object pool - */ - public members: Group; - - // Temp calculation vars - private _drag: number; - private _delta: number; - private _velocityDelta: number; - private _length: number = 0; - private _distance: Vec2; - private _tangent: Vec2; - private _separatedX: boolean; - private _separatedY: boolean; - private _overlap: number; - private _maxOverlap: number; - private _obj1Velocity: number; - private _obj2Velocity: number; - private _obj1NewVelocity: number; - private _obj2NewVelocity: number; - private _average: number; - private _quadTree: QuadTree; - private _quadTreeResult: boolean; - - public bounds: Rectangle; - - public gravity: Vec2; - public drag: Vec2; - public bounce: Vec2; - public angularDrag: number; - - /** - * The overlap bias is used when calculating hull overlap before separation - change it if you have especially small or large GameObjects - * @type {number} - */ - static OVERLAP_BIAS: number = 4; - - /** - * The overlap bias is used when calculating hull overlap before separation - change it if you have especially small or large GameObjects - * @type {number} - */ - static TILE_OVERLAP: boolean = false; - - /** - * @type {number} - */ - public worldDivisions: number = 6; - - - /* - public update() { - - this._length = this._objects.length; - - for (var i = 0; i < this._length; i++) - { - if (this._objects[i]) - { - this._objects[i].preUpdate(); - this.updateMotion(this._objects[i]); - this.collideWorld(this._objects[i]); - - for (var x = 0; x < this._length; x++) - { - if (this._objects[x] && this._objects[x] !== this._objects[i]) - { - //this.collideShapes(this._objects[i], this._objects[x]); - var r = this.NEWseparate(this._objects[i], this._objects[x]); - //console.log('sep', r); - } - } - - } - } - - } - - public render() { - - // iterate through the objects here, updating and colliding - for (var i = 0; i < this._length; i++) - { - if (this._objects[i]) - { - this._objects[i].render(this.game.stage.context); - } - } - - } -*/ - - public updateMotion(body: Phaser.Physics.Body) { - - if (body.type == Types.BODY_DISABLED) - { - return; - } - - this._velocityDelta = (this.computeVelocity(body.angularVelocity, body.gravity.x, body.angularAcceleration, body.angularDrag, body.maxAngular) - body.angularVelocity) / 2; - body.angularVelocity += this._velocityDelta; - body.sprite.transform.rotation += body.angularVelocity * this.game.time.elapsed; - body.angularVelocity += this._velocityDelta; - - this._velocityDelta = (this.computeVelocity(body.velocity.x, body.gravity.x, body.acceleration.x, body.drag.x) - body.velocity.x) / 2; - body.velocity.x += this._velocityDelta; - this._delta = body.velocity.x * this.game.time.elapsed; - body.velocity.x += this._velocityDelta; - //body.position.x += this._delta; - body.sprite.x += this._delta; - - this._velocityDelta = (this.computeVelocity(body.velocity.y, body.gravity.y, body.acceleration.y, body.drag.y) - body.velocity.y) / 2; - body.velocity.y += this._velocityDelta; - this._delta = body.velocity.y * this.game.time.elapsed; - body.velocity.y += this._velocityDelta; - //body.position.y += this._delta; - body.sprite.y += this._delta; - - } - - /** - * A tween-like function that takes a starting velocity and some other factors and returns an altered velocity. - * - * @param {number} Velocity Any component of velocity (e.g. 20). - * @param {number} Acceleration Rate at which the velocity is changing. - * @param {number} Drag Really kind of a deceleration, this is how much the velocity changes if Acceleration is not set. - * @param {number} Max An absolute value cap for the velocity. - * - * @return {number} The altered Velocity value. - */ - public computeVelocity(velocity: number, gravity: number = 0, acceleration: number = 0, drag: number = 0, max: number = 10000): number { - - if (acceleration !== 0) - { - velocity += (acceleration + gravity) * this.game.time.elapsed; - } - else if (drag !== 0) - { - this._drag = drag * this.game.time.elapsed; - - if (velocity - this._drag > 0) - { - velocity = velocity - this._drag; - } - else if (velocity + this._drag < 0) - { - velocity += this._drag; - } - else - { - velocity = 0; - } - - velocity += gravity; - } - - if ((velocity != 0) && (max != 10000)) - { - if (velocity > max) - { - velocity = max; - } - else if (velocity < -max) - { - velocity = -max; - } - } - - return velocity; - - } - - /** - * The core Collision separation method. - * @param body1 The first Physics.Body to separate - * @param body2 The second Physics.Body to separate - * @returns {boolean} Returns true if the bodies were separated, otherwise false. - */ - public separate(body1: Body, body2: Body): boolean { - - this._separatedX = this.separateBodyX(body1, body2); - this._separatedY = this.separateBodyY(body1, body2); - - return this._separatedX || this._separatedY; - - } - - public checkHullIntersection(body1: Body, body2:Body): boolean { - return ((body1.hullX + body1.hullWidth > body2.hullX) && (body1.hullX < body2.hullX + body2.hullWidth) && (body1.hullY + body1.hullHeight > body2.hullY) && (body1.hullY < body2.hullY + body2.hullHeight)); - } - - /** - * Separates the two objects on their x axis - * @param object1 The first GameObject to separate - * @param object2 The second GameObject to separate - * @returns {boolean} Whether the objects in fact touched and were separated along the X axis. - */ - public separateBodyX(body1: Body, body2: Body): boolean { - - // Can't separate two disabled or static objects - if ((body1.type == Types.BODY_DISABLED || body1.type == Types.BODY_STATIC) && (body2.type == Types.BODY_DISABLED || body2.type == Types.BODY_STATIC)) - { - return false; - } - - // First, get the two object deltas - this._overlap = 0; - - if (body1.deltaX != body2.deltaX) - { - if (RectangleUtils.intersects(body1.bounds, body2.bounds)) - { - this._maxOverlap = body1.deltaXAbs + body2.deltaXAbs + ArcadePhysics.OVERLAP_BIAS; - - // If they did overlap (and can), figure out by how much and flip the corresponding flags - if (body1.deltaX > body2.deltaX) - { - this._overlap = body1.bounds.right - body2.bounds.x; - - if ((this._overlap > this._maxOverlap) || !(body1.allowCollisions & Types.RIGHT) || !(body2.allowCollisions & Types.LEFT)) - { - this._overlap = 0; - } - else - { - body1.touching |= Types.RIGHT; - body2.touching |= Types.LEFT; - } - } - else if (body1.deltaX < body2.deltaX) - { - this._overlap = body1.bounds.x - body2.bounds.width - body2.bounds.x; - - if ((-this._overlap > this._maxOverlap) || !(body1.allowCollisions & Types.LEFT) || !(body2.allowCollisions & Types.RIGHT)) - { - this._overlap = 0; - } - else - { - body1.touching |= Types.LEFT; - body2.touching |= Types.RIGHT; - } - } - } - } - - // Then adjust their positions and velocities accordingly (if there was any overlap) - if (this._overlap != 0) - { - this._obj1Velocity = body1.velocity.x; - this._obj2Velocity = body2.velocity.x; - - /** - * Dynamic = gives and receives impacts - * Static = gives but doesn't receive impacts, cannot be moved by physics - * Kinematic = gives impacts, but never receives, can be moved by physics - */ - - // 2 dynamic bodies will exchange velocities - if (body1.type == Types.BODY_DYNAMIC && body2.type == Types.BODY_DYNAMIC) - { - this._overlap *= 0.5; - body1.position.x = body1.position.x - this._overlap; - body2.position.x += this._overlap; - - this._obj1NewVelocity = Math.sqrt((this._obj2Velocity * this._obj2Velocity * body2.mass) / body1.mass) * ((this._obj2Velocity > 0) ? 1 : -1); - this._obj2NewVelocity = Math.sqrt((this._obj1Velocity * this._obj1Velocity * body1.mass) / body2.mass) * ((this._obj1Velocity > 0) ? 1 : -1); - this._average = (this._obj1NewVelocity + this._obj2NewVelocity) * 0.5; - this._obj1NewVelocity -= this._average; - this._obj2NewVelocity -= this._average; - body1.velocity.x = this._average + this._obj1NewVelocity * body1.bounce.x; - body2.velocity.x = this._average + this._obj2NewVelocity * body2.bounce.x; - } - else if (body2.type != Types.BODY_DYNAMIC) - { - // Body 2 is Static or Kinematic - this._overlap *= 2; - body1.position.x -= this._overlap; - body1.velocity.x = this._obj2Velocity - this._obj1Velocity * body1.bounce.x; - } - else if (body1.type != Types.BODY_DYNAMIC) - { - // Body 1 is Static or Kinematic - this._overlap *= 2; - body2.position.x += this._overlap; - body2.velocity.x = this._obj1Velocity - this._obj2Velocity * body2.bounce.x; - } - - return true; - } - else - { - return false; - } - - } - - /** - * Separates the two objects on their y axis - * @param object1 The first GameObject to separate - * @param object2 The second GameObject to separate - * @returns {boolean} Whether the objects in fact touched and were separated along the Y axis. - */ - public separateBodyY(body1: Body, body2: Body): boolean { - - // Can't separate two immovable objects - if ((body1.type == Types.BODY_DISABLED || body1.type == Types.BODY_STATIC) && (body2.type == Types.BODY_DISABLED || body2.type == Types.BODY_STATIC)) - { - return false; - } - - // First, get the two object deltas - this._overlap = 0; - - if (body1.deltaY != body2.deltaY) - { - if (RectangleUtils.intersects(body1.bounds, body2.bounds)) - { - // This is the only place to use the DeltaAbs values - this._maxOverlap = body1.deltaYAbs + body2.deltaYAbs + ArcadePhysics.OVERLAP_BIAS; - - // If they did overlap (and can), figure out by how much and flip the corresponding flags - if (body1.deltaY > body2.deltaY) - { - this._overlap = body1.bounds.bottom - body2.bounds.y; - - if ((this._overlap > this._maxOverlap) || !(body1.allowCollisions & Types.DOWN) || !(body2.allowCollisions & Types.UP)) - { - this._overlap = 0; - } - else - { - body1.touching |= Types.DOWN; - body2.touching |= Types.UP; - } - } - else if (body1.deltaY < body2.deltaY) - { - this._overlap = body1.bounds.y - body2.bounds.height - body2.bounds.y; - - if ((-this._overlap > this._maxOverlap) || !(body1.allowCollisions & Types.UP) || !(body2.allowCollisions & Types.DOWN)) - { - this._overlap = 0; - } - else - { - body1.touching |= Types.UP; - body2.touching |= Types.DOWN; - } - } - } - } - - // Then adjust their positions and velocities accordingly (if there was any overlap) - if (this._overlap != 0) - { - this._obj1Velocity = body1.velocity.y; - this._obj2Velocity = body2.velocity.y; - - /** - * Dynamic = gives and receives impacts - * Static = gives but doesn't receive impacts, cannot be moved by physics - * Kinematic = gives impacts, but never receives, can be moved by physics - */ - - if (body1.type == Types.BODY_DYNAMIC && body2.type == Types.BODY_DYNAMIC) - { - this._overlap *= 0.5; - body1.position.y = body1.position.y - this._overlap; - body2.position.y += this._overlap; - - this._obj1NewVelocity = Math.sqrt((this._obj2Velocity * this._obj2Velocity * body2.mass) / body1.mass) * ((this._obj2Velocity > 0) ? 1 : -1); - this._obj2NewVelocity = Math.sqrt((this._obj1Velocity * this._obj1Velocity * body1.mass) / body2.mass) * ((this._obj1Velocity > 0) ? 1 : -1); - var average: number = (this._obj1NewVelocity + this._obj2NewVelocity) * 0.5; - this._obj1NewVelocity -= average; - this._obj2NewVelocity -= average; - body1.velocity.y = average + this._obj1NewVelocity * body1.bounce.y; - body2.velocity.y = average + this._obj2NewVelocity * body2.bounce.y; - } - else if (body2.type != Types.BODY_DYNAMIC) - { - this._overlap *= 2; - body1.position.y -= this._overlap; - body1.velocity.y = this._obj2Velocity - this._obj1Velocity * body1.bounce.y; - // This is special case code that handles things like horizontal moving platforms you can ride - //if (body2.parent.active && body2.moves && (body1.deltaY > body2.deltaY)) - if (body2.sprite.active && (body1.deltaY > body2.deltaY)) - { - body1.position.x += body2.position.x - body2.oldPosition.x; - } - } - else if (body1.type != Types.BODY_DYNAMIC) - { - this._overlap *= 2; - body2.position.y += this._overlap; - body2.velocity.y = this._obj1Velocity - this._obj2Velocity * body2.bounce.y; - // This is special case code that handles things like horizontal moving platforms you can ride - //if (object1.active && body1.moves && (body1.deltaY < body2.deltaY)) - if (body1.sprite.active && (body1.deltaY < body2.deltaY)) - { - body2.position.x += body1.position.x - body1.oldPosition.x; - } - } - - return true; - } - else - { - return false; - } - } - - - - - - - - /* - private TILEseparate(shapeA: IPhysicsShape, shapeB: IPhysicsShape, distance: Vec2, tangent: Vec2) { - - if (tangent.x == 1) - { - console.log('1 The left side of ShapeA hit the right side of ShapeB', Math.floor(distance.x)); - shapeA.physics.touching |= Phaser.Types.LEFT; - shapeB.physics.touching |= Phaser.Types.RIGHT; - } - else if (tangent.x == -1) - { - console.log('2 The right side of ShapeA hit the left side of ShapeB', Math.floor(distance.x)); - shapeA.physics.touching |= Phaser.Types.RIGHT; - shapeB.physics.touching |= Phaser.Types.LEFT; - } - - if (tangent.y == 1) - { - console.log('3 The top of ShapeA hit the bottom of ShapeB', Math.floor(distance.y)); - shapeA.physics.touching |= Phaser.Types.UP; - shapeB.physics.touching |= Phaser.Types.DOWN; - } - else if (tangent.y == -1) - { - console.log('4 The bottom of ShapeA hit the top of ShapeB', Math.floor(distance.y)); - shapeA.physics.touching |= Phaser.Types.DOWN; - shapeB.physics.touching |= Phaser.Types.UP; - } - - - // only apply collision response forces if the object is travelling into, and not out of, the collision - var dot = Vec2Utils.dot(shapeA.physics.velocity, tangent); - - if (dot < 0) - { - console.log('in to', dot); - - // Apply horizontal bounce - if (shapeA.physics.bounce.x > 0) - { - shapeA.physics.velocity.x *= -(shapeA.physics.bounce.x); - } - else - { - shapeA.physics.velocity.x = 0; - } - // Apply horizontal bounce - if (shapeA.physics.bounce.y > 0) - { - shapeA.physics.velocity.y *= -(shapeA.physics.bounce.y); - } - else - { - shapeA.physics.velocity.y = 0; - } - } - else - { - console.log('out of', dot); - } - - shapeA.position.x += Math.floor(distance.x); - //shapeA.bounds.x += Math.floor(distance.x); - - shapeA.position.y += Math.floor(distance.y); - //shapeA.bounds.y += distance.y; - - console.log('------------------------------------------------'); - - } - - private collideWorld(shape:IPhysicsShape) { - - // Collide on the x-axis - this._distance.x = shape.world.bounds.x - (shape.position.x - shape.bounds.halfWidth); - - if (0 < this._distance.x) - { - // Hit Left - this._tangent.setTo(1, 0); - this.separateXWall(shape, this._distance, this._tangent); - } - else - { - this._distance.x = (shape.position.x + shape.bounds.halfWidth) - shape.world.bounds.right; - - if (0 < this._distance.x) - { - // Hit Right - this._tangent.setTo(-1, 0); - this._distance.reverse(); - this.separateXWall(shape, this._distance, this._tangent); - } - } - - // Collide on the y-axis - this._distance.y = shape.world.bounds.y - (shape.position.y - shape.bounds.halfHeight); - - if (0 < this._distance.y) - { - // Hit Top - this._tangent.setTo(0, 1); - this.separateYWall(shape, this._distance, this._tangent); - } - else - { - this._distance.y = (shape.position.y + shape.bounds.halfHeight) - shape.world.bounds.bottom; - - if (0 < this._distance.y) - { - // Hit Bottom - this._tangent.setTo(0, -1); - this._distance.reverse(); - this.separateYWall(shape, this._distance, this._tangent); - } - } - - } - - private separateX(shapeA: IPhysicsShape, shapeB: IPhysicsShape, distance: Vec2, tangent: Vec2) { - - if (tangent.x == 1) - { - console.log('The left side of ShapeA hit the right side of ShapeB', distance.x); - shapeA.physics.touching |= Phaser.Types.LEFT; - shapeB.physics.touching |= Phaser.Types.RIGHT; - } - else - { - console.log('The right side of ShapeA hit the left side of ShapeB', distance.x); - shapeA.physics.touching |= Phaser.Types.RIGHT; - shapeB.physics.touching |= Phaser.Types.LEFT; - } - - // collision edges - //shapeA.oH = tangent.x; - - // only apply collision response forces if the object is travelling into, and not out of, the collision - if (Vec2Utils.dot(shapeA.physics.velocity, tangent) < 0) - { - // Apply horizontal bounce - if (shapeA.physics.bounce.x > 0) - { - shapeA.physics.velocity.x *= -(shapeA.physics.bounce.x); - } - else - { - shapeA.physics.velocity.x = 0; - } - } - - shapeA.position.x += distance.x; - shapeA.bounds.x += distance.x; - - } - - private separateY(shapeA: IPhysicsShape, shapeB: IPhysicsShape, distance: Vec2, tangent: Vec2) { - - if (tangent.y == 1) - { - console.log('The top of ShapeA hit the bottom of ShapeB', distance.y); - shapeA.physics.touching |= Phaser.Types.UP; - shapeB.physics.touching |= Phaser.Types.DOWN; - } - else - { - console.log('The bottom of ShapeA hit the top of ShapeB', distance.y); - shapeA.physics.touching |= Phaser.Types.DOWN; - shapeB.physics.touching |= Phaser.Types.UP; - } - - // collision edges - //shapeA.oV = tangent.y; - - // only apply collision response forces if the object is travelling into, and not out of, the collision - if (Vec2Utils.dot(shapeA.physics.velocity, tangent) < 0) - { - // Apply horizontal bounce - if (shapeA.physics.bounce.y > 0) - { - shapeA.physics.velocity.y *= -(shapeA.physics.bounce.y); - } - else - { - shapeA.physics.velocity.y = 0; - } - } - - shapeA.position.y += distance.y; - shapeA.bounds.y += distance.y; - - } - - private separateXWall(shapeA: IPhysicsShape, distance: Vec2, tangent: Vec2) { - - if (tangent.x == 1) - { - console.log('The left side of ShapeA hit the right side of ShapeB', distance.x); - shapeA.physics.touching |= Phaser.Types.LEFT; - } - else - { - console.log('The right side of ShapeA hit the left side of ShapeB', distance.x); - shapeA.physics.touching |= Phaser.Types.RIGHT; - } - - // collision edges - //shapeA.oH = tangent.x; - - // only apply collision response forces if the object is travelling into, and not out of, the collision - if (Vec2Utils.dot(shapeA.physics.velocity, tangent) < 0) - { - // Apply horizontal bounce - if (shapeA.physics.bounce.x > 0) - { - shapeA.physics.velocity.x *= -(shapeA.physics.bounce.x); - } - else - { - shapeA.physics.velocity.x = 0; - } - } - - shapeA.position.x += distance.x; - - } - - private separateYWall(shapeA: IPhysicsShape, distance: Vec2, tangent: Vec2) { - - if (tangent.y == 1) - { - console.log('The top of ShapeA hit the bottom of ShapeB', distance.y); - shapeA.physics.touching |= Phaser.Types.UP; - } - else - { - console.log('The bottom of ShapeA hit the top of ShapeB', distance.y); - shapeA.physics.touching |= Phaser.Types.DOWN; - } - - // collision edges - //shapeA.oV = tangent.y; - - // only apply collision response forces if the object is travelling into, and not out of, the collision - if (Vec2Utils.dot(shapeA.physics.velocity, tangent) < 0) - { - // Apply horizontal bounce - if (shapeA.physics.bounce.y > 0) - { - shapeA.physics.velocity.y *= -(shapeA.physics.bounce.y); - } - else - { - shapeA.physics.velocity.y = 0; - } - } - - shapeA.position.y += distance.y; - - } - */ - - /** - * Checks for overlaps between two objects using the world QuadTree. Can be Sprite vs. Sprite, Sprite vs. Group or Group vs. Group. - * Note: Does not take the objects scrollFactor into account. All overlaps are check in world space. - * @param object1 The first Sprite or Group to check. If null the world.group is used. - * @param object2 The second Sprite or Group to check. - * @param notifyCallback A callback function that is called if the objects overlap. The two objects will be passed to this function in the same order in which you passed them to Collision.overlap. - * @param processCallback A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then notifyCallback will only be called if processCallback returns true. - * @param context The context in which the callbacks will be called - * @returns {boolean} true if the objects overlap, otherwise false. - */ - public overlap(object1 = null, object2 = null, notifyCallback = null, processCallback = null, context = null): boolean { - - /* - if (object1 == null) - { - object1 = this.game.world.group; - } - - if (object2 == object1) - { - object2 = null; - } - - QuadTree.divisions = this.worldDivisions; - - this._quadTree = new Phaser.QuadTree(this, this.bounds.x, this.bounds.y, this.bounds.width, this.bounds.height); - - this._quadTree.load(object1, object2, notifyCallback, processCallback, context); - - this._quadTreeResult = this._quadTree.execute(); - - console.log('over', this._quadTreeResult); - - this._quadTree.destroy(); - - this._quadTree = null; - - return this._quadTreeResult; - */ - - return false; - - } - - - - - - - /** - * Collision resolution specifically for GameObjects vs. Tiles. - * @param object The GameObject to separate - * @param tile The Tile to separate - * @returns {boolean} Whether the objects in fact touched and were separated - */ - public separateTile(object:Sprite, x: number, y: number, width: number, height: number, mass: number, collideLeft: boolean, collideRight: boolean, collideUp: boolean, collideDown: boolean, separateX: boolean, separateY: boolean): boolean { - - //var separatedX: boolean = this.separateTileX(object, x, y, width, height, mass, collideLeft, collideRight, separateX); - //var separatedY: boolean = this.separateTileY(object, x, y, width, height, mass, collideUp, collideDown, separateY); - - //return separatedX || separatedY; - - return false; - - } - - /** - * Separates the two objects on their x axis - * @param object The GameObject to separate - * @param tile The Tile to separate - * @returns {boolean} Whether the objects in fact touched and were separated along the X axis. - */ - /* - public separateTileX(object:Sprite, x: number, y: number, width: number, height: number, mass: number, collideLeft: boolean, collideRight: boolean, separate: boolean): boolean { - - // Can't separate two immovable objects (tiles are always immovable) - if (object.immovable) - { - return false; - } - - // First, get the object delta - var overlap: number = 0; - var objDelta: number = object.x - object.last.x; - //var objDelta: number = object.collisionMask.deltaX; - - if (objDelta != 0) - { - // Check if the X hulls actually overlap - var objDeltaAbs: number = (objDelta > 0) ? objDelta : -objDelta; - //var objDeltaAbs: number = object.collisionMask.deltaXAbs; - var objBounds: Rectangle = new Rectangle(object.x - ((objDelta > 0) ? objDelta : 0), object.last.y, object.width + ((objDelta > 0) ? objDelta : -objDelta), object.height); - - if ((objBounds.x + objBounds.width > x) && (objBounds.x < x + width) && (objBounds.y + objBounds.height > y) && (objBounds.y < y + height)) - { - var maxOverlap: number = objDeltaAbs + Collision.OVERLAP_BIAS; - - // If they did overlap (and can), figure out by how much and flip the corresponding flags - if (objDelta > 0) - { - overlap = object.x + object.width - x; - - if ((overlap > maxOverlap) || !(object.allowCollisions & Collision.RIGHT) || collideLeft == false) - { - overlap = 0; - } - else - { - object.touching |= Collision.RIGHT; - } - } - else if (objDelta < 0) - { - overlap = object.x - width - x; - - if ((-overlap > maxOverlap) || !(object.allowCollisions & Collision.LEFT) || collideRight == false) - { - overlap = 0; - } - else - { - object.touching |= Collision.LEFT; - } - - } - - } - } - - // Then adjust their positions and velocities accordingly (if there was any overlap) - if (overlap != 0) - { - if (separate == true) - { - //console.log(' - object.x = object.x - overlap; - object.velocity.x = -(object.velocity.x * object.elasticity); - } - - Collision.TILE_OVERLAP = true; - return true; - } - else - { - return false; - } - - } - */ - - /** - * Separates the two objects on their y axis - * @param object The first GameObject to separate - * @param tile The second GameObject to separate - * @returns {boolean} Whether the objects in fact touched and were separated along the Y axis. - */ - /* - public separateTileY(object: Sprite, x: number, y: number, width: number, height: number, mass: number, collideUp: boolean, collideDown: boolean, separate: boolean): boolean { - - // Can't separate two immovable objects (tiles are always immovable) - if (object.immovable) - { - return false; - } - - // First, get the two object deltas - var overlap: number = 0; - var objDelta: number = object.y - object.last.y; - - if (objDelta != 0) - { - // Check if the Y hulls actually overlap - var objDeltaAbs: number = (objDelta > 0) ? objDelta : -objDelta; - var objBounds: Rectangle = new Rectangle(object.x, object.y - ((objDelta > 0) ? objDelta : 0), object.width, object.height + objDeltaAbs); - - if ((objBounds.x + objBounds.width > x) && (objBounds.x < x + width) && (objBounds.y + objBounds.height > y) && (objBounds.y < y + height)) - { - var maxOverlap: number = objDeltaAbs + Collision.OVERLAP_BIAS; - - // If they did overlap (and can), figure out by how much and flip the corresponding flags - if (objDelta > 0) - { - overlap = object.y + object.height - y; - - if ((overlap > maxOverlap) || !(object.allowCollisions & Collision.DOWN) || collideUp == false) - { - overlap = 0; - } - else - { - object.touching |= Collision.DOWN; - } - } - else if (objDelta < 0) - { - overlap = object.y - height - y; - - if ((-overlap > maxOverlap) || !(object.allowCollisions & Collision.UP) || collideDown == false) - { - overlap = 0; - } - else - { - object.touching |= Collision.UP; - } - } - } - } - - // TODO - with super low velocities you get lots of stuttering, set some kind of base minimum here - - // Then adjust their positions and velocities accordingly (if there was any overlap) - if (overlap != 0) - { - if (separate == true) - { - object.y = object.y - overlap; - object.velocity.y = -(object.velocity.y * object.elasticity); - } - - Collision.TILE_OVERLAP = true; - return true; - } - else - { - return false; - } - } - */ - - - /** - * Separates the two objects on their x axis - * @param object The GameObject to separate - * @param tile The Tile to separate - * @returns {boolean} Whether the objects in fact touched and were separated along the X axis. - */ - /* - public static NEWseparateTileX(object:Sprite, x: number, y: number, width: number, height: number, mass: number, collideLeft: boolean, collideRight: boolean, separate: boolean): boolean { - - // Can't separate two immovable objects (tiles are always immovable) - if (object.immovable) - { - return false; - } - - // First, get the object delta - var overlap: number = 0; - - if (object.collisionMask.deltaX != 0) - { - // Check if the X hulls actually overlap - //var objDeltaAbs: number = (objDelta > 0) ? objDelta : -objDelta; - //var objBounds: Rectangle = new Rectangle(object.x - ((objDelta > 0) ? objDelta : 0), object.last.y, object.width + ((objDelta > 0) ? objDelta : -objDelta), object.height); - - //if ((objBounds.x + objBounds.width > x) && (objBounds.x < x + width) && (objBounds.y + objBounds.height > y) && (objBounds.y < y + height)) - if (object.collisionMask.intersectsRaw(x, x + width, y, y + height)) - { - var maxOverlap: number = object.collisionMask.deltaXAbs + Collision.OVERLAP_BIAS; - - // If they did overlap (and can), figure out by how much and flip the corresponding flags - if (object.collisionMask.deltaX > 0) - { - //overlap = object.x + object.width - x; - overlap = object.collisionMask.right - x; - - if ((overlap > maxOverlap) || !(object.allowCollisions & Collision.RIGHT) || collideLeft == false) - { - overlap = 0; - } - else - { - object.touching |= Collision.RIGHT; - } - } - else if (object.collisionMask.deltaX < 0) - { - //overlap = object.x - width - x; - overlap = object.collisionMask.x - width - x; - - if ((-overlap > maxOverlap) || !(object.allowCollisions & Collision.LEFT) || collideRight == false) - { - overlap = 0; - } - else - { - object.touching |= Collision.LEFT; - } - - } - - } - } - - // Then adjust their positions and velocities accordingly (if there was any overlap) - if (overlap != 0) - { - if (separate == true) - { - object.x = object.x - overlap; - object.velocity.x = -(object.velocity.x * object.elasticity); - } - - Collision.TILE_OVERLAP = true; - return true; - } - else - { - return false; - } - - } - */ - - /** - * Separates the two objects on their y axis - * @param object The first GameObject to separate - * @param tile The second GameObject to separate - * @returns {boolean} Whether the objects in fact touched and were separated along the Y axis. - */ - /* - public NEWseparateTileY(object: Sprite, x: number, y: number, width: number, height: number, mass: number, collideUp: boolean, collideDown: boolean, separate: boolean): boolean { - - // Can't separate two immovable objects (tiles are always immovable) - if (object.immovable) - { - return false; - } - - // First, get the two object deltas - var overlap: number = 0; - //var objDelta: number = object.y - object.last.y; - - if (object.collisionMask.deltaY != 0) - { - // Check if the Y hulls actually overlap - //var objDeltaAbs: number = (objDelta > 0) ? objDelta : -objDelta; - //var objBounds: Rectangle = new Rectangle(object.x, object.y - ((objDelta > 0) ? objDelta : 0), object.width, object.height + objDeltaAbs); - - //if ((objBounds.x + objBounds.width > x) && (objBounds.x < x + width) && (objBounds.y + objBounds.height > y) && (objBounds.y < y + height)) - if (object.collisionMask.intersectsRaw(x, x + width, y, y + height)) - { - //var maxOverlap: number = objDeltaAbs + Collision.OVERLAP_BIAS; - var maxOverlap: number = object.collisionMask.deltaYAbs + Collision.OVERLAP_BIAS; - - // If they did overlap (and can), figure out by how much and flip the corresponding flags - if (object.collisionMask.deltaY > 0) - { - //overlap = object.y + object.height - y; - overlap = object.collisionMask.bottom - y; - - if ((overlap > maxOverlap) || !(object.allowCollisions & Collision.DOWN) || collideUp == false) - { - overlap = 0; - } - else - { - object.touching |= Collision.DOWN; - } - } - else if (object.collisionMask.deltaY < 0) - { - //overlap = object.y - height - y; - overlap = object.collisionMask.y - height - y; - - if ((-overlap > maxOverlap) || !(object.allowCollisions & Collision.UP) || collideDown == false) - { - overlap = 0; - } - else - { - object.touching |= Collision.UP; - } - } - } - } - - // TODO - with super low velocities you get lots of stuttering, set some kind of base minimum here - - // Then adjust their positions and velocities accordingly (if there was any overlap) - if (overlap != 0) - { - if (separate == true) - { - object.y = object.y - overlap; - object.velocity.y = -(object.velocity.y * object.elasticity); - } - - Collision.TILE_OVERLAP = true; - return true; - } - else - { - return false; - } - } - */ - - } - -} \ No newline at end of file diff --git a/todo/oldphysics/arcade/Body.js b/todo/oldphysics/arcade/Body.js deleted file mode 100644 index 9d439d5a..00000000 --- a/todo/oldphysics/arcade/Body.js +++ /dev/null @@ -1,233 +0,0 @@ -var Phaser; -(function (Phaser) { - /// - /// - /// - /// - /** - * Phaser - ArcadePhysics - Body - */ - (function (Physics) { - var Body = (function () { - function Body(sprite, type) { - this.angularVelocity = 0; - this.angularAcceleration = 0; - this.angularDrag = 0; - this.maxAngular = 10000; - this.mass = 1; - this._width = 0; - this._height = 0; - this.sprite = sprite; - this.game = sprite.game; - this.type = type; - // Fixture properties - // Will extend into its own class at a later date - can move the fixture defs there and add shape support, but this will do for 1.0 release - this.bounds = new Phaser.Rectangle(); - this._width = sprite.width; - this._height = sprite.height; - // Body properties - //this.gravity = Vec2Utils.clone(ArcadePhysics.gravity); - //this.bounce = Vec2Utils.clone(ArcadePhysics.bounce); - this.velocity = new Phaser.Vec2(); - this.acceleration = new Phaser.Vec2(); - //this.drag = Vec2Utils.clone(ArcadePhysics.drag); - this.maxVelocity = new Phaser.Vec2(10000, 10000); - this.angularVelocity = 0; - this.angularAcceleration = 0; - this.angularDrag = 0; - this.touching = Phaser.Types.NONE; - this.wasTouching = Phaser.Types.NONE; - this.allowCollisions = Phaser.Types.ANY; - this.position = new Phaser.Vec2(sprite.x + this.bounds.halfWidth, sprite.y + this.bounds.halfHeight); - this.oldPosition = new Phaser.Vec2(sprite.x + this.bounds.halfWidth, sprite.y + this.bounds.halfHeight); - this.offset = new Phaser.Vec2(); - } - Object.defineProperty(Body.prototype, "x", { - get: function () { - return this.sprite.x + this.offset.x; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Body.prototype, "y", { - get: function () { - return this.sprite.y + this.offset.y; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Body.prototype, "width", { - get: function () { - return this._width * this.sprite.transform.scale.x; - }, - set: function (value) { - this._width = value; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Body.prototype, "height", { - get: function () { - return this._height * this.sprite.transform.scale.y; - }, - set: function (value) { - this._height = value; - }, - enumerable: true, - configurable: true - }); - Body.prototype.preUpdate = function () { - this.oldPosition.copyFrom(this.position); - this.bounds.x = this.x; - this.bounds.y = this.y; - this.bounds.width = this.width; - this.bounds.height = this.height; - }; - Body.prototype.postUpdate = // Shall we do this? Or just update the values directly in the separate functions? But then the bounds will be out of sync - as long as - // the bounds are updated and used in calculations then we can do one final sprite movement here I guess? - function () { - // if this is all it does maybe move elsewhere? Sprite postUpdate? - if(this.type !== Phaser.Types.BODY_DISABLED) { - //this.game.world.physics.updateMotion(this); - this.wasTouching = this.touching; - this.touching = Phaser.Types.NONE; - } - this.position.setTo(this.x, this.y); - }; - Object.defineProperty(Body.prototype, "hullWidth", { - get: function () { - if(this.deltaX > 0) { - return this.bounds.width + this.deltaX; - } else { - return this.bounds.width - this.deltaX; - } - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Body.prototype, "hullHeight", { - get: function () { - if(this.deltaY > 0) { - return this.bounds.height + this.deltaY; - } else { - return this.bounds.height - this.deltaY; - } - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Body.prototype, "hullX", { - get: function () { - if(this.position.x < this.oldPosition.x) { - return this.position.x; - } else { - return this.oldPosition.x; - } - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Body.prototype, "hullY", { - get: function () { - if(this.position.y < this.oldPosition.y) { - return this.position.y; - } else { - return this.oldPosition.y; - } - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Body.prototype, "deltaXAbs", { - get: function () { - return (this.deltaX > 0 ? this.deltaX : -this.deltaX); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Body.prototype, "deltaYAbs", { - get: function () { - return (this.deltaY > 0 ? this.deltaY : -this.deltaY); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Body.prototype, "deltaX", { - get: function () { - return this.position.x - this.oldPosition.x; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Body.prototype, "deltaY", { - get: function () { - return this.position.y - this.oldPosition.y; - }, - enumerable: true, - configurable: true - }); - Body.prototype.render = // MOVE THESE TO A UTIL - function (context) { - context.beginPath(); - context.strokeStyle = 'rgb(0,255,0)'; - context.strokeRect(this.position.x - this.bounds.halfWidth, this.position.y - this.bounds.halfHeight, this.bounds.width, this.bounds.height); - context.stroke(); - context.closePath(); - // center point - context.fillStyle = 'rgb(0,255,0)'; - context.fillRect(this.position.x, this.position.y, 2, 2); - if(this.touching & Phaser.Types.LEFT) { - context.beginPath(); - context.strokeStyle = 'rgb(255,0,0)'; - context.moveTo(this.position.x - this.bounds.halfWidth, this.position.y - this.bounds.halfHeight); - context.lineTo(this.position.x - this.bounds.halfWidth, this.position.y + this.bounds.halfHeight); - context.stroke(); - context.closePath(); - } - if(this.touching & Phaser.Types.RIGHT) { - context.beginPath(); - context.strokeStyle = 'rgb(255,0,0)'; - context.moveTo(this.position.x + this.bounds.halfWidth, this.position.y - this.bounds.halfHeight); - context.lineTo(this.position.x + this.bounds.halfWidth, this.position.y + this.bounds.halfHeight); - context.stroke(); - context.closePath(); - } - if(this.touching & Phaser.Types.UP) { - context.beginPath(); - context.strokeStyle = 'rgb(255,0,0)'; - context.moveTo(this.position.x - this.bounds.halfWidth, this.position.y - this.bounds.halfHeight); - context.lineTo(this.position.x + this.bounds.halfWidth, this.position.y - this.bounds.halfHeight); - context.stroke(); - context.closePath(); - } - if(this.touching & Phaser.Types.DOWN) { - context.beginPath(); - context.strokeStyle = 'rgb(255,0,0)'; - context.moveTo(this.position.x - this.bounds.halfWidth, this.position.y + this.bounds.halfHeight); - context.lineTo(this.position.x + this.bounds.halfWidth, this.position.y + this.bounds.halfHeight); - context.stroke(); - context.closePath(); - } - }; - Body.prototype.renderDebugInfo = /** - * Render debug infos. (including name, bounds info, position and some other properties) - * @param x {number} X position of the debug info to be rendered. - * @param y {number} Y position of the debug info to be rendered. - * @param [color] {number} color of the debug info to be rendered. (format is css color string) - */ - function (x, y, color) { - if (typeof color === "undefined") { color = 'rgb(255,255,255)'; } - this.sprite.texture.context.fillStyle = color; - this.sprite.texture.context.fillText('Sprite: (' + this.sprite.width + ' x ' + this.sprite.height + ')', x, y); - //this.sprite.texture.context.fillText('x: ' + this._sprite.frameBounds.x.toFixed(1) + ' y: ' + this._sprite.frameBounds.y.toFixed(1) + ' rotation: ' + this._sprite.rotation.toFixed(1), x, y + 14); - this.sprite.texture.context.fillText('x: ' + this.bounds.x.toFixed(1) + ' y: ' + this.bounds.y.toFixed(1) + ' rotation: ' + this.sprite.transform.rotation.toFixed(0), x, y + 14); - this.sprite.texture.context.fillText('vx: ' + this.velocity.x.toFixed(1) + ' vy: ' + this.velocity.y.toFixed(1), x, y + 28); - this.sprite.texture.context.fillText('acx: ' + this.acceleration.x.toFixed(1) + ' acy: ' + this.acceleration.y.toFixed(1), x, y + 42); - this.sprite.texture.context.fillText('angVx: ' + this.angularVelocity.toFixed(1) + ' angAc: ' + this.angularAcceleration.toFixed(1), x, y + 56); - }; - return Body; - })(); - Physics.Body = Body; - })(Phaser.Physics || (Phaser.Physics = {})); - var Physics = Phaser.Physics; -})(Phaser || (Phaser = {})); diff --git a/todo/oldphysics/arcade/Body.ts b/todo/oldphysics/arcade/Body.ts deleted file mode 100644 index 714c74c5..00000000 --- a/todo/oldphysics/arcade/Body.ts +++ /dev/null @@ -1,311 +0,0 @@ -/// -/// -/// -/// - -/** -* Phaser - ArcadePhysics - Body -*/ - -module Phaser.Physics { - - export class Body { - - constructor(sprite: Phaser.Sprite, type: number) { - - this.sprite = sprite; - this.game = sprite.game; - this.type = type; - - // Fixture properties - // Will extend into its own class at a later date - can move the fixture defs there and add shape support, but this will do for 1.0 release - this.bounds = new Rectangle; - - this._width = sprite.width; - this._height = sprite.height; - - - // Body properties - //this.gravity = Vec2Utils.clone(ArcadePhysics.gravity); - //this.bounce = Vec2Utils.clone(ArcadePhysics.bounce); - - this.velocity = new Vec2; - this.acceleration = new Vec2; - //this.drag = Vec2Utils.clone(ArcadePhysics.drag); - this.maxVelocity = new Vec2(10000, 10000); - - this.angularVelocity = 0; - this.angularAcceleration = 0; - this.angularDrag = 0; - - this.touching = Types.NONE; - this.wasTouching = Types.NONE; - this.allowCollisions = Types.ANY; - - this.position = new Vec2(sprite.x + this.bounds.halfWidth, sprite.y + this.bounds.halfHeight); - this.oldPosition = new Vec2(sprite.x + this.bounds.halfWidth, sprite.y + this.bounds.halfHeight); - this.offset = new Vec2; - - } - - /** - * Reference to Phaser.Game - */ - public game: Game; - - /** - * Reference to the parent Sprite - */ - public sprite: Phaser.Sprite; - - /** - * The type of Body (disabled, dynamic, static or kinematic) - * Disabled = skips all physics operations / tests (default) - * Dynamic = gives and receives impacts - * Static = gives but doesn't receive impacts, cannot be moved by physics - * Kinematic = gives impacts, but never receives, can be moved by physics - * @type {number} - */ - public type: number; - - public gravity: Vec2; - public bounce: Vec2; - - public velocity: Vec2; - public acceleration: Vec2; - public drag: Vec2; - public maxVelocity: Vec2; - - public angularVelocity: number = 0; - public angularAcceleration: number = 0; - public angularDrag: number = 0; - public maxAngular: number = 10000; - - /** - * Orientation of the object. - * @type {number} - */ - public facing: number; - - public touching: number; - public allowCollisions: number; - public wasTouching: number; - public mass: number = 1; - - public position: Vec2; - public oldPosition: Vec2; - public offset: Vec2; - public bounds: Rectangle; - - - - private _width: number = 0; - private _height: number = 0; - - public get x(): number { - return this.sprite.x + this.offset.x; - } - - public get y(): number { - return this.sprite.y + this.offset.y; - } - - public set width(value: number) { - this._width = value; - } - - public set height(value: number) { - this._height = value; - } - - public get width(): number { - return this._width * this.sprite.transform.scale.x; - } - - public get height(): number { - return this._height * this.sprite.transform.scale.y; - } - - public preUpdate() { - - this.oldPosition.copyFrom(this.position); - - this.bounds.x = this.x; - this.bounds.y = this.y; - this.bounds.width = this.width; - this.bounds.height = this.height; - - } - - // Shall we do this? Or just update the values directly in the separate functions? But then the bounds will be out of sync - as long as - // the bounds are updated and used in calculations then we can do one final sprite movement here I guess? - public postUpdate() { - - // if this is all it does maybe move elsewhere? Sprite postUpdate? - if (this.type !== Phaser.Types.BODY_DISABLED) - { - //this.game.world.physics.updateMotion(this); - - this.wasTouching = this.touching; - this.touching = Phaser.Types.NONE; - - } - - this.position.setTo(this.x, this.y); - - } - - public get hullWidth(): number { - - if (this.deltaX > 0) - { - return this.bounds.width + this.deltaX; - } - else - { - return this.bounds.width - this.deltaX; - } - - } - - public get hullHeight(): number { - - if (this.deltaY > 0) - { - return this.bounds.height + this.deltaY; - } - else - { - return this.bounds.height - this.deltaY; - } - - } - - public get hullX(): number { - - if (this.position.x < this.oldPosition.x) - { - return this.position.x; - } - else - { - return this.oldPosition.x; - } - - } - - public get hullY(): number { - - if (this.position.y < this.oldPosition.y) - { - return this.position.y; - } - else - { - return this.oldPosition.y; - } - - } - - public get deltaXAbs(): number { - return (this.deltaX > 0 ? this.deltaX : -this.deltaX); - } - - public get deltaYAbs(): number { - return (this.deltaY > 0 ? this.deltaY : -this.deltaY); - } - - public get deltaX(): number { - return this.position.x - this.oldPosition.x; - } - - public get deltaY(): number { - return this.position.y - this.oldPosition.y; - } - - - - - - - - - - - // MOVE THESE TO A UTIL - - public render(context:CanvasRenderingContext2D) { - - context.beginPath(); - context.strokeStyle = 'rgb(0,255,0)'; - context.strokeRect(this.position.x - this.bounds.halfWidth, this.position.y - this.bounds.halfHeight, this.bounds.width, this.bounds.height); - context.stroke(); - context.closePath(); - - // center point - context.fillStyle = 'rgb(0,255,0)'; - context.fillRect(this.position.x, this.position.y, 2, 2); - - if (this.touching & Phaser.Types.LEFT) - { - context.beginPath(); - context.strokeStyle = 'rgb(255,0,0)'; - context.moveTo(this.position.x - this.bounds.halfWidth, this.position.y - this.bounds.halfHeight); - context.lineTo(this.position.x - this.bounds.halfWidth, this.position.y + this.bounds.halfHeight); - context.stroke(); - context.closePath(); - } - if (this.touching & Phaser.Types.RIGHT) - { - context.beginPath(); - context.strokeStyle = 'rgb(255,0,0)'; - context.moveTo(this.position.x + this.bounds.halfWidth, this.position.y - this.bounds.halfHeight); - context.lineTo(this.position.x + this.bounds.halfWidth, this.position.y + this.bounds.halfHeight); - context.stroke(); - context.closePath(); - } - - if (this.touching & Phaser.Types.UP) - { - context.beginPath(); - context.strokeStyle = 'rgb(255,0,0)'; - context.moveTo(this.position.x - this.bounds.halfWidth, this.position.y - this.bounds.halfHeight); - context.lineTo(this.position.x + this.bounds.halfWidth, this.position.y - this.bounds.halfHeight); - context.stroke(); - context.closePath(); - } - if (this.touching & Phaser.Types.DOWN) - { - context.beginPath(); - context.strokeStyle = 'rgb(255,0,0)'; - context.moveTo(this.position.x - this.bounds.halfWidth, this.position.y + this.bounds.halfHeight); - context.lineTo(this.position.x + this.bounds.halfWidth, this.position.y + this.bounds.halfHeight); - context.stroke(); - context.closePath(); - } - - } - - - /** - * Render debug infos. (including name, bounds info, position and some other properties) - * @param x {number} X position of the debug info to be rendered. - * @param y {number} Y position of the debug info to be rendered. - * @param [color] {number} color of the debug info to be rendered. (format is css color string) - */ - public renderDebugInfo(x: number, y: number, color: string = 'rgb(255,255,255)') { - - this.sprite.texture.context.fillStyle = color; - this.sprite.texture.context.fillText('Sprite: (' + this.sprite.width + ' x ' + this.sprite.height + ')', x, y); - //this.sprite.texture.context.fillText('x: ' + this._sprite.frameBounds.x.toFixed(1) + ' y: ' + this._sprite.frameBounds.y.toFixed(1) + ' rotation: ' + this._sprite.rotation.toFixed(1), x, y + 14); - this.sprite.texture.context.fillText('x: ' + this.bounds.x.toFixed(1) + ' y: ' + this.bounds.y.toFixed(1) + ' rotation: ' + this.sprite.transform.rotation.toFixed(0), x, y + 14); - this.sprite.texture.context.fillText('vx: ' + this.velocity.x.toFixed(1) + ' vy: ' + this.velocity.y.toFixed(1), x, y + 28); - this.sprite.texture.context.fillText('acx: ' + this.acceleration.x.toFixed(1) + ' acy: ' + this.acceleration.y.toFixed(1), x, y + 42); - this.sprite.texture.context.fillText('angVx: ' + this.angularVelocity.toFixed(1) + ' angAc: ' + this.angularAcceleration.toFixed(1), x, y + 56); - - } - - - } - -} \ No newline at end of file diff --git a/todo/oldphysics/arcade/Motion.js b/todo/oldphysics/arcade/Motion.js deleted file mode 100644 index 3048dd5c..00000000 --- a/todo/oldphysics/arcade/Motion.js +++ /dev/null @@ -1,303 +0,0 @@ -/// -/// -/** -* Phaser - Motion -* -* The Motion class contains lots of useful functions for moving game objects around in world space. -*/ -var Phaser; -(function (Phaser) { - var Motion = (function () { - function Motion(game) { - this.game = game; - } - Motion.prototype.velocityFromAngle = /** - * Given the angle and speed calculate the velocity and return it as a Point - * - * @param {number} angle The angle (in degrees) calculated in clockwise positive direction (down = 90 degrees positive, right = 0 degrees positive, up = 90 degrees negative) - * @param {number} speed The speed it will move, in pixels per second sq - * - * @return {Point} A Point where Point.x contains the velocity x value and Point.y contains the velocity y value - */ - function (angle, speed) { - if(isNaN(speed)) { - speed = 0; - } - var a = this.game.math.degreesToRadians(angle); - return new Phaser.Point((Math.cos(a) * speed), (Math.sin(a) * speed)); - }; - Motion.prototype.moveTowardsObject = /** - * Sets the source Sprite x/y velocity so it will move directly towards the destination Sprite at the speed given (in pixels per second)
- * If you specify a maxTime then it will adjust the speed (over-writing what you set) so it arrives at the destination in that number of seconds.
- * Timings are approximate due to the way Flash timers work, and irrespective of SWF frame rate. Allow for a variance of +- 50ms.
- * The source object doesn't stop moving automatically should it ever reach the destination coordinates.
- * If you need the object to accelerate, see accelerateTowardsObject() instead - * Note: Doesn't take into account acceleration, maxVelocity or drag (if you set drag or acceleration too high this object may not move at all) - * - * @param {Sprite} source The Sprite on which the velocity will be set - * @param {Sprite} dest The Sprite where the source object will move to - * @param {number} speed The speed it will move, in pixels per second (default is 60 pixels/sec) - * @param {number} maxTime Time given in milliseconds (1000 = 1 sec). If set the speed is adjusted so the source will arrive at destination in the given number of ms - */ - function (source, dest, speed, maxTime) { - if (typeof speed === "undefined") { speed = 60; } - if (typeof maxTime === "undefined") { maxTime = 0; } - var a = this.angleBetween(source, dest); - if(maxTime > 0) { - var d = this.distanceBetween(source, dest); - // We know how many pixels we need to move, but how fast? - speed = d / (maxTime / 1000); - } - source.body.velocity.x = Math.cos(a) * speed; - source.body.velocity.y = Math.sin(a) * speed; - }; - Motion.prototype.accelerateTowardsObject = /** - * Sets the x/y acceleration on the source Sprite so it will move towards the destination Sprite at the speed given (in pixels per second)
- * You must give a maximum speed value, beyond which the Sprite won't go any faster.
- * If you don't need acceleration look at moveTowardsObject() instead. - * - * @param {Sprite} source The Sprite on which the acceleration will be set - * @param {Sprite} dest The Sprite where the source object will move towards - * @param {number} speed The speed it will accelerate in pixels per second - * @param {number} xSpeedMax The maximum speed in pixels per second in which the sprite can move horizontally - * @param {number} ySpeedMax The maximum speed in pixels per second in which the sprite can move vertically - */ - function (source, dest, speed, xSpeedMax, ySpeedMax) { - /* - var a: number = this.angleBetween(source, dest); - - source.body.velocity.x = 0; - source.body.velocity.y = 0; - - source.body.acceleration.x = Math.cos(a) * speed; - source.body.acceleration.y = Math.sin(a) * speed; - - source.body.maxVelocity.x = xSpeedMax; - source.body.maxVelocity.y = ySpeedMax; - */ - }; - Motion.prototype.moveTowardsMouse = /** - * Move the given Sprite towards the mouse pointer coordinates at a steady velocity - * If you specify a maxTime then it will adjust the speed (over-writing what you set) so it arrives at the destination in that number of seconds.
- * Timings are approximate due to the way Flash timers work, and irrespective of SWF frame rate. Allow for a variance of +- 50ms.
- * The source object doesn't stop moving automatically should it ever reach the destination coordinates.
- * - * @param {Sprite} source The Sprite to move - * @param {number} speed The speed it will move, in pixels per second (default is 60 pixels/sec) - * @param {number} maxTime Time given in milliseconds (1000 = 1 sec). If set the speed is adjusted so the source will arrive at destination in the given number of ms - */ - function (source, speed, maxTime) { - if (typeof speed === "undefined") { speed = 60; } - if (typeof maxTime === "undefined") { maxTime = 0; } - var a = this.angleBetweenMouse(source); - if(maxTime > 0) { - var d = this.distanceToMouse(source); - // We know how many pixels we need to move, but how fast? - speed = d / (maxTime / 1000); - } - source.body.velocity.x = Math.cos(a) * speed; - source.body.velocity.y = Math.sin(a) * speed; - }; - Motion.prototype.accelerateTowardsMouse = /** - * Sets the x/y acceleration on the source Sprite so it will move towards the mouse coordinates at the speed given (in pixels per second)
- * You must give a maximum speed value, beyond which the Sprite won't go any faster.
- * If you don't need acceleration look at moveTowardsMouse() instead. - * - * @param {Sprite} source The Sprite on which the acceleration will be set - * @param {number} speed The speed it will accelerate in pixels per second - * @param {number} xSpeedMax The maximum speed in pixels per second in which the sprite can move horizontally - * @param {number} ySpeedMax The maximum speed in pixels per second in which the sprite can move vertically - */ - function (source, speed, xSpeedMax, ySpeedMax) { - /* - var a: number = this.angleBetweenMouse(source); - - source.body.velocity.x = 0; - source.body.velocity.y = 0; - - source.body.acceleration.x = Math.cos(a) * speed; - source.body.acceleration.y = Math.sin(a) * speed; - - source.body.maxVelocity.x = xSpeedMax; - source.body.maxVelocity.y = ySpeedMax; - */ - }; - Motion.prototype.moveTowardsPoint = /** - * Sets the x/y velocity on the source Sprite so it will move towards the target coordinates at the speed given (in pixels per second)
- * If you specify a maxTime then it will adjust the speed (over-writing what you set) so it arrives at the destination in that number of seconds.
- * Timings are approximate due to the way Flash timers work, and irrespective of SWF frame rate. Allow for a variance of +- 50ms.
- * The source object doesn't stop moving automatically should it ever reach the destination coordinates.
- * - * @param {Sprite} source The Sprite to move - * @param {Point} target The Point coordinates to move the source Sprite towards - * @param {number} speed The speed it will move, in pixels per second (default is 60 pixels/sec) - * @param {number} maxTime Time given in milliseconds (1000 = 1 sec). If set the speed is adjusted so the source will arrive at destination in the given number of ms - */ - function (source, target, speed, maxTime) { - if (typeof speed === "undefined") { speed = 60; } - if (typeof maxTime === "undefined") { maxTime = 0; } - var a = this.angleBetweenPoint(source, target); - if(maxTime > 0) { - var d = this.distanceToPoint(source, target); - // We know how many pixels we need to move, but how fast? - speed = d / (maxTime / 1000); - } - source.body.velocity.x = Math.cos(a) * speed; - source.body.velocity.y = Math.sin(a) * speed; - }; - Motion.prototype.accelerateTowardsPoint = /** - * Sets the x/y acceleration on the source Sprite so it will move towards the target coordinates at the speed given (in pixels per second)
- * You must give a maximum speed value, beyond which the Sprite won't go any faster.
- * If you don't need acceleration look at moveTowardsPoint() instead. - * - * @param {Sprite} source The Sprite on which the acceleration will be set - * @param {Point} target The Point coordinates to move the source Sprite towards - * @param {number} speed The speed it will accelerate in pixels per second - * @param {number} xSpeedMax The maximum speed in pixels per second in which the sprite can move horizontally - * @param {number} ySpeedMax The maximum speed in pixels per second in which the sprite can move vertically - */ - function (source, target, speed, xSpeedMax, ySpeedMax) { - /* - var a: number = this.angleBetweenPoint(source, target); - - source.body.velocity.x = 0; - source.body.velocity.y = 0; - - source.body.acceleration.x = Math.cos(a) * speed; - source.body.acceleration.y = Math.sin(a) * speed; - - source.body.maxVelocity.x = xSpeedMax; - source.body.maxVelocity.y = ySpeedMax; - */ - }; - Motion.prototype.distanceBetween = /** - * Find the distance between two Sprites, taking their origin into account - * - * @param {Sprite} a The first Sprite - * @param {Sprite} b The second Sprite - * @return {number} int Distance (in pixels) - */ - function (a, b) { - return Phaser.Vec2Utils.distance(a.body.position, b.body.position); - }; - Motion.prototype.distanceToPoint = /** - * Find the distance from an Sprite to the given Point, taking the source origin into account - * - * @param {Sprite} a The Sprite - * @param {Point} target The Point - * @return {number} Distance (in pixels) - */ - function (a, target) { - var dx = (a.x + a.transform.origin.x) - (target.x); - var dy = (a.y + a.transform.origin.y) - (target.y); - return this.game.math.vectorLength(dx, dy); - }; - Motion.prototype.distanceToMouse = /** - * Find the distance (in pixels, rounded) from the object x/y and the mouse x/y - * - * @param {Sprite} a Sprite to test against - * @return {number} The distance between the given sprite and the mouse coordinates - */ - function (a) { - var dx = (a.x + a.transform.origin.x) - this.game.input.x; - var dy = (a.y + a.transform.origin.y) - this.game.input.y; - return this.game.math.vectorLength(dx, dy); - }; - Motion.prototype.angleBetweenPoint = /** - * Find the angle (in radians) between an Sprite and an Point. The source sprite takes its x/y and origin into account. - * The angle is calculated in clockwise positive direction (down = 90 degrees positive, right = 0 degrees positive, up = 90 degrees negative) - * - * @param {Sprite} a The Sprite to test from - * @param {Point} target The Point to angle the Sprite towards - * @param {boolean} asDegrees If you need the value in degrees instead of radians, set to true - * - * @return {number} The angle (in radians unless asDegrees is true) - */ - function (a, target, asDegrees) { - if (typeof asDegrees === "undefined") { asDegrees = false; } - var dx = (target.x) - (a.x + a.transform.origin.x); - var dy = (target.y) - (a.y + a.transform.origin.y); - if(asDegrees) { - return this.game.math.radiansToDegrees(Math.atan2(dy, dx)); - } else { - return Math.atan2(dy, dx); - } - }; - Motion.prototype.angleBetween = /** - * Find the angle (in radians) between the two Sprite, taking their x/y and origin into account. - * The angle is calculated in clockwise positive direction (down = 90 degrees positive, right = 0 degrees positive, up = 90 degrees negative) - * - * @param {Sprite} a The Sprite to test from - * @param {Sprite} b The Sprite to test to - * @param {boolean} asDegrees If you need the value in degrees instead of radians, set to true - * - * @return {number} The angle (in radians unless asDegrees is true) - */ - function (a, b, asDegrees) { - if (typeof asDegrees === "undefined") { asDegrees = false; } - var dx = (b.x + b.transform.origin.x) - (a.x + a.transform.origin.x); - var dy = (b.y + b.transform.origin.y) - (a.y + a.transform.origin.y); - if(asDegrees) { - return this.game.math.radiansToDegrees(Math.atan2(dy, dx)); - } else { - return Math.atan2(dy, dx); - } - }; - Motion.prototype.velocityFromFacing = /** - * Given the Sprite and speed calculate the velocity and return it as an Point based on the direction the sprite is facing - * - * @param {Sprite} parent The Sprite to get the facing value from - * @param {number} speed The speed it will move, in pixels per second sq - * - * @return {Point} An Point where Point.x contains the velocity x value and Point.y contains the velocity y value - */ - function (parent, speed) { - /* - var a: number; - - if (parent.body.facing == Types.LEFT) - { - a = this.game.math.degreesToRadians(180); - } - else if (parent.body.facing == Types.RIGHT) - { - a = this.game.math.degreesToRadians(0); - } - else if (parent.body.facing == Types.UP) - { - a = this.game.math.degreesToRadians(-90); - } - else if (parent.body.facing == Types.DOWN) - { - a = this.game.math.degreesToRadians(90); - } - - return new Point(Math.cos(a) * speed, Math.sin(a) * speed); - */ - return new Phaser.Point(); - }; - Motion.prototype.angleBetweenMouse = /** - * Find the angle (in radians) between an Sprite and the mouse, taking their x/y and origin into account. - * The angle is calculated in clockwise positive direction (down = 90 degrees positive, right = 0 degrees positive, up = 90 degrees negative) - * - * @param {Sprite} a The Object to test from - * @param {boolean} asDegrees If you need the value in degrees instead of radians, set to true - * - * @return {number} The angle (in radians unless asDegrees is true) - */ - function (a, asDegrees) { - if (typeof asDegrees === "undefined") { asDegrees = false; } - // In order to get the angle between the object and mouse, we need the objects screen coordinates (rather than world coordinates) - var p = Phaser.SpriteUtils.getScreenXY(a); - var dx = a.game.input.x - p.x; - var dy = a.game.input.y - p.y; - if(asDegrees) { - return this.game.math.radiansToDegrees(Math.atan2(dy, dx)); - } else { - return Math.atan2(dy, dx); - } - }; - return Motion; - })(); - Phaser.Motion = Motion; -})(Phaser || (Phaser = {})); diff --git a/todo/oldphysics/arcade/Motion.ts b/todo/oldphysics/arcade/Motion.ts deleted file mode 100644 index 1a65fccc..00000000 --- a/todo/oldphysics/arcade/Motion.ts +++ /dev/null @@ -1,363 +0,0 @@ -///-/// - -/** -* Phaser - Motion -* -* The Motion class contains lots of useful functions for moving game objects around in world space. -*/ - -module Phaser { - - export class Motion { - - constructor(game: Game) { - this.game = game; - } - - public game: Game; - - /** - * Given the angle and speed calculate the velocity and return it as a Point - * - * @param {number} angle The angle (in degrees) calculated in clockwise positive direction (down = 90 degrees positive, right = 0 degrees positive, up = 90 degrees negative) - * @param {number} speed The speed it will move, in pixels per second sq - * - * @return {Point} A Point where Point.x contains the velocity x value and Point.y contains the velocity y value - */ - public velocityFromAngle(angle: number, speed: number): Point { - - if (isNaN(speed)) - { - speed = 0; - } - - var a: number = this.game.math.degreesToRadians(angle); - - return new Point((Math.cos(a) * speed), (Math.sin(a) * speed)); - - } - - /** - * Sets the source Sprite x/y velocity so it will move directly towards the destination Sprite at the speed given (in pixels per second)
- * If you specify a maxTime then it will adjust the speed (over-writing what you set) so it arrives at the destination in that number of seconds.
- * Timings are approximate due to the way Flash timers work, and irrespective of SWF frame rate. Allow for a variance of +- 50ms.
- * The source object doesn't stop moving automatically should it ever reach the destination coordinates.
- * If you need the object to accelerate, see accelerateTowardsObject() instead - * Note: Doesn't take into account acceleration, maxVelocity or drag (if you set drag or acceleration too high this object may not move at all) - * - * @param {Sprite} source The Sprite on which the velocity will be set - * @param {Sprite} dest The Sprite where the source object will move to - * @param {number} speed The speed it will move, in pixels per second (default is 60 pixels/sec) - * @param {number} maxTime Time given in milliseconds (1000 = 1 sec). If set the speed is adjusted so the source will arrive at destination in the given number of ms - */ - public moveTowardsObject(source: Sprite, dest: Sprite, speed: number = 60, maxTime: number = 0) { - - var a: number = this.angleBetween(source, dest); - - if (maxTime > 0) - { - var d: number = this.distanceBetween(source, dest); - - // We know how many pixels we need to move, but how fast? - speed = d / (maxTime / 1000); - } - - source.body.velocity.x = Math.cos(a) * speed; - source.body.velocity.y = Math.sin(a) * speed; - - } - - /** - * Sets the x/y acceleration on the source Sprite so it will move towards the destination Sprite at the speed given (in pixels per second)
- * You must give a maximum speed value, beyond which the Sprite won't go any faster.
- * If you don't need acceleration look at moveTowardsObject() instead. - * - * @param {Sprite} source The Sprite on which the acceleration will be set - * @param {Sprite} dest The Sprite where the source object will move towards - * @param {number} speed The speed it will accelerate in pixels per second - * @param {number} xSpeedMax The maximum speed in pixels per second in which the sprite can move horizontally - * @param {number} ySpeedMax The maximum speed in pixels per second in which the sprite can move vertically - */ - public accelerateTowardsObject(source: Sprite, dest: Sprite, speed: number, xSpeedMax: number, ySpeedMax: number) { - - /* - var a: number = this.angleBetween(source, dest); - - source.body.velocity.x = 0; - source.body.velocity.y = 0; - - source.body.acceleration.x = Math.cos(a) * speed; - source.body.acceleration.y = Math.sin(a) * speed; - - source.body.maxVelocity.x = xSpeedMax; - source.body.maxVelocity.y = ySpeedMax; - */ - - } - - /** - * Move the given Sprite towards the mouse pointer coordinates at a steady velocity - * If you specify a maxTime then it will adjust the speed (over-writing what you set) so it arrives at the destination in that number of seconds.
- * Timings are approximate due to the way Flash timers work, and irrespective of SWF frame rate. Allow for a variance of +- 50ms.
- * The source object doesn't stop moving automatically should it ever reach the destination coordinates.
- * - * @param {Sprite} source The Sprite to move - * @param {number} speed The speed it will move, in pixels per second (default is 60 pixels/sec) - * @param {number} maxTime Time given in milliseconds (1000 = 1 sec). If set the speed is adjusted so the source will arrive at destination in the given number of ms - */ - public moveTowardsMouse(source: Sprite, speed: number = 60, maxTime: number = 0) { - - var a: number = this.angleBetweenMouse(source); - - if (maxTime > 0) - { - var d: number = this.distanceToMouse(source); - - // We know how many pixels we need to move, but how fast? - speed = d / (maxTime / 1000); - } - - source.body.velocity.x = Math.cos(a) * speed; - source.body.velocity.y = Math.sin(a) * speed; - - } - - /** - * Sets the x/y acceleration on the source Sprite so it will move towards the mouse coordinates at the speed given (in pixels per second)
- * You must give a maximum speed value, beyond which the Sprite won't go any faster.
- * If you don't need acceleration look at moveTowardsMouse() instead. - * - * @param {Sprite} source The Sprite on which the acceleration will be set - * @param {number} speed The speed it will accelerate in pixels per second - * @param {number} xSpeedMax The maximum speed in pixels per second in which the sprite can move horizontally - * @param {number} ySpeedMax The maximum speed in pixels per second in which the sprite can move vertically - */ - public accelerateTowardsMouse(source: Sprite, speed: number, xSpeedMax: number, ySpeedMax: number) { - - /* - var a: number = this.angleBetweenMouse(source); - - source.body.velocity.x = 0; - source.body.velocity.y = 0; - - source.body.acceleration.x = Math.cos(a) * speed; - source.body.acceleration.y = Math.sin(a) * speed; - - source.body.maxVelocity.x = xSpeedMax; - source.body.maxVelocity.y = ySpeedMax; - */ - - } - - /** - * Sets the x/y velocity on the source Sprite so it will move towards the target coordinates at the speed given (in pixels per second)
- * If you specify a maxTime then it will adjust the speed (over-writing what you set) so it arrives at the destination in that number of seconds.
- * Timings are approximate due to the way Flash timers work, and irrespective of SWF frame rate. Allow for a variance of +- 50ms.
- * The source object doesn't stop moving automatically should it ever reach the destination coordinates.
- * - * @param {Sprite} source The Sprite to move - * @param {Point} target The Point coordinates to move the source Sprite towards - * @param {number} speed The speed it will move, in pixels per second (default is 60 pixels/sec) - * @param {number} maxTime Time given in milliseconds (1000 = 1 sec). If set the speed is adjusted so the source will arrive at destination in the given number of ms - */ - public moveTowardsPoint(source: Sprite, target: Point, speed: number = 60, maxTime: number = 0) { - - var a: number = this.angleBetweenPoint(source, target); - - if (maxTime > 0) - { - var d: number = this.distanceToPoint(source, target); - - // We know how many pixels we need to move, but how fast? - speed = d / (maxTime / 1000); - } - - source.body.velocity.x = Math.cos(a) * speed; - source.body.velocity.y = Math.sin(a) * speed; - } - - /** - * Sets the x/y acceleration on the source Sprite so it will move towards the target coordinates at the speed given (in pixels per second)
- * You must give a maximum speed value, beyond which the Sprite won't go any faster.
- * If you don't need acceleration look at moveTowardsPoint() instead. - * - * @param {Sprite} source The Sprite on which the acceleration will be set - * @param {Point} target The Point coordinates to move the source Sprite towards - * @param {number} speed The speed it will accelerate in pixels per second - * @param {number} xSpeedMax The maximum speed in pixels per second in which the sprite can move horizontally - * @param {number} ySpeedMax The maximum speed in pixels per second in which the sprite can move vertically - */ - public accelerateTowardsPoint(source: Sprite, target: Point, speed: number, xSpeedMax: number, ySpeedMax: number) { - - /* - var a: number = this.angleBetweenPoint(source, target); - - source.body.velocity.x = 0; - source.body.velocity.y = 0; - - source.body.acceleration.x = Math.cos(a) * speed; - source.body.acceleration.y = Math.sin(a) * speed; - - source.body.maxVelocity.x = xSpeedMax; - source.body.maxVelocity.y = ySpeedMax; - */ - - } - - /** - * Find the distance between two Sprites, taking their origin into account - * - * @param {Sprite} a The first Sprite - * @param {Sprite} b The second Sprite - * @return {number} int Distance (in pixels) - */ - public distanceBetween(a: Sprite, b: Sprite): number { - return Vec2Utils.distance(a.body.position, b.body.position); - } - - /** - * Find the distance from an Sprite to the given Point, taking the source origin into account - * - * @param {Sprite} a The Sprite - * @param {Point} target The Point - * @return {number} Distance (in pixels) - */ - public distanceToPoint(a: Sprite, target: Point): number { - var dx: number = (a.x + a.transform.origin.x) - (target.x); - var dy: number = (a.y + a.transform.origin.y) - (target.y); - - return this.game.math.vectorLength(dx, dy); - } - - /** - * Find the distance (in pixels, rounded) from the object x/y and the mouse x/y - * - * @param {Sprite} a Sprite to test against - * @return {number} The distance between the given sprite and the mouse coordinates - */ - public distanceToMouse(a: Sprite): number { - var dx: number = (a.x + a.transform.origin.x) - this.game.input.x; - var dy: number = (a.y + a.transform.origin.y) - this.game.input.y; - - return this.game.math.vectorLength(dx, dy); - } - - /** - * Find the angle (in radians) between an Sprite and an Point. The source sprite takes its x/y and origin into account. - * The angle is calculated in clockwise positive direction (down = 90 degrees positive, right = 0 degrees positive, up = 90 degrees negative) - * - * @param {Sprite} a The Sprite to test from - * @param {Point} target The Point to angle the Sprite towards - * @param {boolean} asDegrees If you need the value in degrees instead of radians, set to true - * - * @return {number} The angle (in radians unless asDegrees is true) - */ - public angleBetweenPoint(a: Sprite, target: Point, asDegrees: boolean = false): number { - - var dx: number = (target.x) - (a.x + a.transform.origin.x); - var dy: number = (target.y) - (a.y + a.transform.origin.y); - - if (asDegrees) - { - return this.game.math.radiansToDegrees(Math.atan2(dy, dx)); - } - else - { - return Math.atan2(dy, dx); - } - - } - - /** - * Find the angle (in radians) between the two Sprite, taking their x/y and origin into account. - * The angle is calculated in clockwise positive direction (down = 90 degrees positive, right = 0 degrees positive, up = 90 degrees negative) - * - * @param {Sprite} a The Sprite to test from - * @param {Sprite} b The Sprite to test to - * @param {boolean} asDegrees If you need the value in degrees instead of radians, set to true - * - * @return {number} The angle (in radians unless asDegrees is true) - */ - public angleBetween(a: Sprite, b: Sprite, asDegrees: boolean = false): number { - - var dx: number = (b.x + b.transform.origin.x) - (a.x + a.transform.origin.x); - var dy: number = (b.y + b.transform.origin.y) - (a.y + a.transform.origin.y); - - if (asDegrees) - { - return this.game.math.radiansToDegrees(Math.atan2(dy, dx)); - } - else - { - return Math.atan2(dy, dx); - } - } - - /** - * Given the Sprite and speed calculate the velocity and return it as an Point based on the direction the sprite is facing - * - * @param {Sprite} parent The Sprite to get the facing value from - * @param {number} speed The speed it will move, in pixels per second sq - * - * @return {Point} An Point where Point.x contains the velocity x value and Point.y contains the velocity y value - */ - public velocityFromFacing(parent: Sprite, speed: number): Point { - - /* - var a: number; - - if (parent.body.facing == Types.LEFT) - { - a = this.game.math.degreesToRadians(180); - } - else if (parent.body.facing == Types.RIGHT) - { - a = this.game.math.degreesToRadians(0); - } - else if (parent.body.facing == Types.UP) - { - a = this.game.math.degreesToRadians(-90); - } - else if (parent.body.facing == Types.DOWN) - { - a = this.game.math.degreesToRadians(90); - } - - return new Point(Math.cos(a) * speed, Math.sin(a) * speed); - */ - - return new Point; - - } - - /** - * Find the angle (in radians) between an Sprite and the mouse, taking their x/y and origin into account. - * The angle is calculated in clockwise positive direction (down = 90 degrees positive, right = 0 degrees positive, up = 90 degrees negative) - * - * @param {Sprite} a The Object to test from - * @param {boolean} asDegrees If you need the value in degrees instead of radians, set to true - * - * @return {number} The angle (in radians unless asDegrees is true) - */ - public angleBetweenMouse(a: Sprite, asDegrees: boolean = false): number { - - // In order to get the angle between the object and mouse, we need the objects screen coordinates (rather than world coordinates) - var p: Point = SpriteUtils.getScreenXY(a); - - var dx: number = a.game.input.x - p.x; - var dy: number = a.game.input.y - p.y; - - if (asDegrees) - { - return this.game.math.radiansToDegrees(Math.atan2(dy, dx)); - } - else - { - return Math.atan2(dy, dx); - } - } - - } - -}