AnimationNote.prototype = Object.create(Phaser.Text.prototype); AnimationNote.constructor = AnimationNote; function AnimationNote(x, y, note, colorString) { // super(game, x, y, "+" + NumberUtil.numberWithCommas(score), AnimationNote.DEFAULT_TEXT_FONT); Phaser.Text.call(this, game, x, y, note, AnimationNote.DEFAULT_TEXT_FONT); if(this == undefined) { this.destroy(); return; } this.anchor.set(0.5); this.inputEnabled = false; /* var grd = this.context.createLinearGradient(0, 0, 0, this.height); if(scoreValue < 0) { grd.addColorStop(0, AnimationNote.COLOR_MINUS_SCORE_GRADATION_1); grd.addColorStop(1, AnimationNote.COLOR_MINUS_SCORE_GRADATION_2); } else { grd.addColorStop(0, AnimationNote.COLOR_PLUS_SCORE_GRADATION_1); grd.addColorStop(1, AnimationNote.COLOR_PLUS_SCORE_GRADATION_2); } this.fill = grd; */ this.fill = colorString; // this.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); this.stroke = '#000'; this.strokeThickness = 5; var tweenAlpha = game.add.tween(this); tweenAlpha.to( { alpha: 0 }, 1000, Phaser.Easing.Linear.None, true); var tweenMoveUp = game.add.tween(this); tweenMoveUp.to( { y: this.y - AnimationNote.MOVE_UP_AMOUNT_PX }, 1000, Phaser.Easing.Linear.None, true); tweenMoveUp.onComplete.addOnce(this.destroySelf, this); game.add.existing(this); }; AnimationNote.prototype.destroySelf = function() { this.destroy(); } AnimationNote.prototype.setScale = function(value) { this.scale.set(value); } AnimationNote.DEFAULT_TEXT_FONT = { font: "30px Arial", boundsAlignH: "center", // left, center. right boundsAlignV: "middle", // top, middle, bottom fill: "#fff" }; AnimationNote.MOVE_UP_AMOUNT_PX = 50; AnimationNote.COLOR_PLUS_SCORE_GRADATION_1 = "#8ED6FF"; AnimationNote.COLOR_PLUS_SCORE_GRADATION_2 = "#004CB3"; AnimationNote.COLOR_MINUS_SCORE_GRADATION_1 = "#FFD68E"; AnimationNote.COLOR_MINUS_SCORE_GRADATION_2 = "#B34C00";