Fix: reduce score not reset in typing practice

This commit is contained in:
2018-11-13 18:28:05 +09:00
parent 11ac9924e6
commit 54b1c76c7d
10 changed files with 87 additions and 66 deletions
-11
View File
@@ -5,7 +5,6 @@ function Animal(type, index, x, y) {
this.posX = x;
this.posY = y;
// this.sprite = game.add.sprite(this.posX, this.posY); //, "snail_run1"); // this.spriteFrameNames.run1);
this.sprite = game.add.sprite(this.posX, this.posY, "animals");
this.sprite.anchor.set(0.5);
this.sprite.animations.add("stand", [index * 2]);
@@ -20,10 +19,6 @@ Animal.prototype.setScale = function(value) {
this.sprite.scale.set(value);
}
// Animal.prototype.setIconSprite = function(species) {
// this.setSpecies(species);
// }
Animal.prototype.setSpecies = function(species) {
console.log(species);
this.species = species;
@@ -51,10 +46,6 @@ Animal.prototype.tweenAnimation = function(animationType) {
}
}
// Animal.prototype.setupAnimation = function() {
// this.stopAnimation();
// }
Animal.prototype.startAnimation = function(species) {
this.sprite.animations.play("run", this.species.fps, true);
}
@@ -86,8 +77,6 @@ Animal.typingCount = function(speciesData, gameType) {
Animal.loadResources = function() {
game.load.spritesheet('animals', '../../../resources/image/character/animal/animals.png', 50, 50);
// game.load.image('snail_shadow', '../../../resources/image/character/animal/snail/shadow.png');
}
+19 -4
View File
@@ -3,14 +3,23 @@ ScoreText.constructor = ScoreText;
function ScoreText(x, y, score) {
// super(game, x, y, "+" + NumberUtil.numberWithCommas(score), ScoreText.DEFAULT_TEXT_FONT);
Phaser.Text.call(this, game, x, y, "+" + NumberUtil.numberWithCommas(score), ScoreText.DEFAULT_TEXT_FONT);
var scoreValue = Number(score);
if(scoreValue > 0)
Phaser.Text.call(this, game, x, y, "+" + NumberUtil.numberWithCommas(score), ScoreText.DEFAULT_TEXT_FONT);
else if(scoreValue < 0)
Phaser.Text.call(this, game, x, y, NumberUtil.numberWithCommas(score), ScoreText.DEFAULT_TEXT_FONT);
this.anchor.set(0.5);
this.inputEnabled = false;
var grd = this.context.createLinearGradient(0, 0, 0, this.height);
grd.addColorStop(0, '#8ED6FF');
grd.addColorStop(1, '#004CB3');
if(scoreValue < 0) {
grd.addColorStop(0, ScoreText.COLOR_MINUS_SCORE_GRADATION_1);
grd.addColorStop(1, ScoreText.COLOR_MINUS_SCORE_GRADATION_2);
} else {
grd.addColorStop(0, ScoreText.COLOR_PLUS_SCORE_GRADATION_1);
grd.addColorStop(1, ScoreText.COLOR_PLUS_SCORE_GRADATION_2);
}
this.fill = grd;
// this.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
this.stroke = '#fff';
@@ -39,4 +48,10 @@ ScoreText.DEFAULT_TEXT_FONT = {
fill: "#fff"
};
ScoreText.MOVE_UP_AMOUNT_PX = 50;
ScoreText.MOVE_UP_AMOUNT_PX = 50;
ScoreText.COLOR_PLUS_SCORE_GRADATION_1 = "#8ED6FF";
ScoreText.COLOR_PLUS_SCORE_GRADATION_2 = "#004CB3";
ScoreText.COLOR_MINUS_SCORE_GRADATION_1 = "#FFD68E";
ScoreText.COLOR_MINUS_SCORE_GRADATION_2 = "#B34C00";