Add: FlyingSaucer class

This commit is contained in:
2019-01-03 11:43:06 +09:00
parent 7434a43fd0
commit eb41faa179
4 changed files with 133 additions and 0 deletions
+62
View File
@@ -44,6 +44,31 @@ var WordFlyingSaucer = {
heartGauge.start();
this.initVariables();
for(var i = 0; i < 10; i++) {
var flyingsaucer = new FlyingSaucer(i);
flyingsaucer.setup(this.wordLevel, this.speedLevel);
flyingsaucer.setActive(true);
}
// input text
var INPUT_TEXT_Y = 680;
this.inputText = new InputTypeText(game.world.centerX, INPUT_TEXT_Y);
this.inputText.anchor.set(0.5);
this.inputText.canvasInput.value('');
this.inputText.canvasInput.focus();
this.inputText.canvasInput.placeHolder("입력 후 [ Enter ]키를 누르세요");
// inputText.canvasInput._onkeydown = this.checkInputText;
// inputText.canvasInput._onkeyup = function() {
var self = this;
this.inputText.canvasInput._onkeyup = function() {
self.checkTypingContents(event);
}
@@ -63,6 +88,12 @@ var WordFlyingSaucer = {
location.href = '../../web/client/menu_app.html';
},
initVariables: function() {
this.wordLevel = 0;
this.speedLevel = 0;
},
startGame: function() {
},
@@ -91,6 +122,37 @@ var WordFlyingSaucer = {
location.href = '../../web/client/result.html';
},
checkTypingContents: function(event) {
if(event.keyCode == Phaser.Keyboard.ENTER) {
// console.log("### enter ###");
var inputContent = this.inputText.canvasInput.value();
/*
var typingContent = this.typingRandomContents[this.typingIndex];
if(inputContent === typingContent) {
this.calculateTypingRecord(typingContent);
this.playNextContent();
if(this.typingIndex == this.typingContentLength)
this.gameOver();
// this.goResult();
// this.state.start('TypingTestResult');
}
*/
}
else {
/*
if(this.isTyping == false) {
// console.log(event);
this.setTimeTypingStart();
}
this.showTypingContentHighlight();
*/
}
},
}