//Augment Module var ITW = (function(itw){ "use strict"; //aliases var components, protot; itw.components = itw.components || Object.create(null); components = itw.components; components.Ship = function(){ this.super.call(this); var _init = function(){ // init stuff here var _texMain = EHDI.Assets.images[ "ship" ]; this._sprMain = new EHDI.aka.Sprite( _texMain ); this._sprMain.x = this._sprMain.width * -0.5; this._sprMain.y = this._sprMain.height * -0.5; this.addChild( this._sprMain ); this.x = -( this._sprMain.width * 0.5 ); this.y = this._sprMain.height * 0.5; this.tl = new TimelineMax({repeat: -1, yoyo: true}); this.tl.to(this, 1, {y: this.y + 3, ease: Power1.easeInOut}); }.bind(this); _init(); } protot = components.Ship.prototype = Object.create(EHDI.aka.Container.prototype); protot.constructor = components.Ship; protot.super = EHDI.aka.Container; protot.pause = function(){ if(!this.tl.paused()) this.tl.pause(); } protot.resume = function(){ if(this.tl.paused()) this.tl.resume(); } protot.getCollisionArea = function(){ return { x: this.x - this._sprMain.width * 0.35, y: this.y + this._sprMain.height * 0.3, width: this._sprMain.width * 0.7, height: this._sprMain.height * 0.14 }; } protot.resetState = function(){ this.x = ITW.SceneMgr.getStageWidth() + ( this._sprMain.width * 0.5 ); this.tl.restart(); if( ITW.GameMgr.getDebug() === true ){ if( typeof this.pixiCircle !== "undefined" ){ if( this.pixiCircle.parent !== null ) this.removeChild( this.pixiCircle ); } this.pixiCircle = new EHDI.aka.Graphics(); this.pixiCircle.beginFill( 0xFF00FF, 0.5 ); this.pixiCircle.drawRect( -( this._sprMain.width * 0.35 ), this._sprMain.height * 0.3, this._sprMain.width * 0.7, this._sprMain.height * 0.14 ); this.pixiCircle.endFill(); this.addChild( this.pixiCircle ); } } protot.destroy = function(){ this.tl.kill(); this.super.prototype.destroy.call(this, {children: true}); } return itw; }(ITW || Object.create(null)));