function Helmet() { this.helmet = game.add.image(0, 0, "helmet"); this.helmet.scale.set(BigMole.SCALE); this.helmetType = Helmet.TYPE_PPYONG this.posY = 0; } Helmet.prototype.getSprite = function() { return this.helmet; } Helmet.prototype.getType = function() { return this.helmetType; } Helmet.prototype.setType = function(value) { this.helmetType = value; } Helmet.prototype.scale = function(value) { this.helmet.scale.set(value); } Helmet.prototype.alpha = function(value) { this.helmet.alpha = value; } Helmet.prototype.move = function(x, y) { this.helmet.x = x; this.helmet.y = y; this.posY = y; } Helmet.prototype.anchor = function(x, y) { this.helmet.anchor.x = x; this.helmet.anchor.y = y; } Helmet.prototype.change = function(type) { this.helmetType = type; switch(this.helmetType) { case Helmet.TYPE_PPYONG: this.helmet.tint = Hammer.COLOR_PPYONG; break; case Helmet.TYPE_WOOD: this.helmet.tint = Hammer.COLOR_WOOD; break; case Helmet.TYPE_BRONZE: this.helmet.tint = Hammer.COLOR_BRONZE; break; case Helmet.TYPE_SILVER: this.helmet.tint = Hammer.COLOR_SILVER; break; case Helmet.TYPE_GOLD: this.helmet.tint = Hammer.COLOR_GOLD; break; } } Helmet.prototype.dropDownTween = function(drowpDownHeight) { this.helmet.y = this.posY - drowpDownHeight; this.tween = game.add.tween(this.helmet) // .from( { y: this.posY - drowpDownHeight }, 10 ) .to( { y: (this.posY) }, Helmet.SHOW_UP_TIME_MS, Phaser.Easing.Bounce.Out); this.tween.start(); } Helmet.TYPE_PPYONG = 1; Helmet.TYPE_WOOD = 2; Helmet.TYPE_BRONZE = 3; Helmet.TYPE_SILVER = 4; Helmet.TYPE_GOLD = 5; Helmet.START_POS_Y = 200; Helmet.SHOW_UP_HEIGHT = 100; Helmet.SHOW_UP_TIME_MS = 200;