//Augment Module var ITW = (function(itw){ "use strict"; //aliases var components, protot; itw.components = itw.components || Object.create(null); components = itw.components; components.SunkenShip = function(){ this.super.call(this); var _init = function(){ // init stuff here var _texMain = EHDI.Assets.images[ "shipwreck" ]; this._sprMain = new EHDI.aka.Sprite( _texMain ); //this._sprMain.scale.set( EHDI.NumberUtil.randomRange(0.65, 1) ); 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 = ITW.SceneMgr.getStageHeight() - ( this._sprMain.height * 0.575 ); }.bind(this); _init(); } protot = components.SunkenShip.prototype = Object.create(EHDI.aka.Container.prototype); protot.constructor = components.SunkenShip; protot.super = EHDI.aka.Container; protot.getCollisionArea = function(){ return { x: this.x - ( this._sprMain.width * 0.174 ), y: this.y - ( this._sprMain.height * 0.128 ), r: ( this._sprMain.width * 0.262 ) }; } protot.resetState = function(){ this._sprMain.scale.set( EHDI.NumberUtil.randomRange(0.65, 1) ); this._sprMain.x = this._sprMain.width * -0.5; this._sprMain.y = this._sprMain.height * -0.5; this.x = ITW.SceneMgr.getStageWidth() + ( this._sprMain.width * 0.5 ); this.y = ITW.SceneMgr.getStageHeight() - ( this._sprMain.height * 0.575 ); 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.drawCircle( ( -( this._sprMain.width * 0.174 ) ), ( -( this._sprMain.height * 0.128 ) ), ( this._sprMain.width * 0.262 ) ); //(x,y,radius) this.pixiCircle.endFill(); this.addChild( this.pixiCircle ); } } protot.destroy = function(){ this.super.prototype.destroy.call(this, {children: true}); } return itw; }(ITW || Object.create(null)));