Add: show animals for practice, test stage and result

Fix: change animal graphic resources
This commit is contained in:
2018-08-28 16:36:38 +09:00
parent 5bfa40d68f
commit c7fe3bf4e5
30 changed files with 317 additions and 9 deletions
+20
View File
@@ -20,6 +20,10 @@ class TypingPractice {
location.href = '../../web/client/menu_typing_practice.html';
});
this.animalOnTitle = new Animal(Animal.TYPE_ON_TITLE, game.world.centerX - 200, 30);
this.animalOnTitle.setSpecies(Animal.SPECIES_DATA[0]);
this.animalOnTitle.startAnimation();
this.typingScore = new TypingScore();
this.stageTimer = new StageTimer( TypingPractice.STAGE_TIMER_SEC, () => {
@@ -138,6 +142,8 @@ class TypingPractice {
this.leftHand.moveToDefaultPosition();
this.rightHand.moveToDefaultPosition();
this.animalOnTitle.stopAnimation();
let gameOverText = new GameOverText();
game.time.events.add(Phaser.Timer.SECOND * 2, this.goResult, this);
}
@@ -160,6 +166,8 @@ class TypingPractice {
// console.log(this.typingRandomContents);
this.typingContentLength = this.typingRandomContents.length;
this.typingIndex = 0;
this.playingAnimalIndex = 0;
}
@@ -352,6 +360,13 @@ class TypingPractice {
if(this.isKeyPressed(inputContent, typingContent)) {
this.typingScore.increase();
let animalLevelID = this.animalOnTitle.animalLevelIDByRecord(this.typingScore.score());
if(animalLevelID > this.playingAnimalIndex) {
this.playingAnimalIndex = animalLevelID;
this.animalOnTitle.setSpecies(Animal.SPECIES_DATA[this.playingAnimalIndex]);;
this.animalOnTitle.tweenAnimation(Animal.ANIMATION_TYPE_CHANGE);
this.animalOnTitle.startAnimation();
}
this.playNextContent();
if(this.typingIndex === this.typingContentLength) {
@@ -359,6 +374,11 @@ class TypingPractice {
}
} else {
this.typingScore.reset();
this.playingAnimalIndex = 0;
this.animalOnTitle.setSpecies(Animal.SPECIES_DATA[this.playingAnimalIndex]);;
this.animalOnTitle.startAnimation();
this.animalOnTitle.tweenAnimation(Animal.ANIMATION_TYPE_DAMAGE);
}
}