Add: mole grey, mole peach, small moles

This commit is contained in:
2018-10-05 17:07:26 +09:00
parent de26c72441
commit 545eba7b96
9 changed files with 50 additions and 26 deletions
+7 -2
View File
@@ -336,13 +336,18 @@ var WhacAMole = {
return;
}
this.textTypingContent.text = this.typingRandomLetters[this.typingIndex];
var nextLetter = this.typingRandomLetters[this.typingIndex];
this.textTypingContent.text = nextLetter;
// var keyID = this.keyboard.keyMapper.getKeyIDOfText(this.typingRandomLetters[this.typingIndex]);
var keyID = this.keyMapper.getKeyIDOfText(nextLetter);
// console.log(keyID);
this.bigMole.changeColor(keyID);
this.bigMole.showUp();
this.keyboardMole.changeColor(keyID);
this.keyboardMole.show();
this.keyboardMole.moveToKey(this.typingRandomLetters[this.typingIndex]);
this.keyboardMole.moveToKey(nextLetter);
for(var i = 0; i < WhacAMole.TYPING_CONTENT_PREVIEW_COUNT; i++) {
+4 -1
View File
@@ -29,7 +29,10 @@ var Loading = {
startLoading: function() {
game.load.image('icon_fullscreen', '../../../resources/image/icon/fullscreen_white.png');
game.load.image('mole', '../../../resources/image/character/mole.png');
game.load.image('mole_grey', '../../../resources/image/character/mole_grey.png');
game.load.image('mole_grey_small', '../../../resources/image/character/mole_grey_32x32.png');
game.load.image('mole_peach', '../../../resources/image/character/mole_peach.png');
game.load.image('mole_peach_small', '../../../resources/image/character/mole_peach_32x32.png');
// game.load.image('hand_left', '../../../resources/image/ui/hand_left.png');
+39 -23
View File
@@ -1,9 +1,13 @@
function Mole(x, y, scale) {
this.mole = game.add.image(x, y, "mole");
this.mole.scale.set(scale);
// this.move(x, y);
function Mole(x, y, type) {
if(type == Mole.TYPE_BIG_MOLE) {
this.mole = game.add.image(x, y, "mole_grey");
this.mole.scale.set(BigMole.SCALE);
} else {
this.mole = game.add.image(x, y, "mole_grey_small");
this.mole.scale.set(KeyboardMole.SCALE);
}
// return this.mole;
this.posY = y;
}
Mole.prototype.alpha = function(value) {
@@ -23,21 +27,17 @@ Mole.prototype.anchor = function(x, y) {
}
Mole.prototype.showUpTween = function(showUpHeight) {
// if(this.tween != undefined && this.tween.isRunning) {
// this.tween.stop();
// // this.tween.pendingDelete = false;
// // this.mole.y = BigMole.START_POS_Y;
// }
// console.log(this.mole);
// console.log("this.posY : " + this.posY);
this.tween = game.add.tween(this.mole)
.from( { y: BigMole.START_POS_Y }, 10 )
.to( { y: BigMole.SHOW_UP_POS_Y }, BigMole.SHOW_UP_TIME_MS, "Quart.easeOut");
// .from( { y: this.posY }, 10 )
// .to( { y: (this.posY + showUpHeight) }, BigMole.SHOW_UP_TIME_MS, "Quart.easeOut");
// .from( { y: BigMole.START_POS_Y }, 10 )
// .to( { y: BigMole.SHOW_UP_POS_Y }, BigMole.SHOW_UP_TIME_MS, "Quart.easeOut");
.from( { y: this.posY }, 10 )
.to( { y: (this.posY - showUpHeight) }, BigMole.SHOW_UP_TIME_MS, "Quart.easeOut");
this.tween.start();
}
Mole.TYPE_BIG_MOLE = "big_mole";
Mole.TYPE_KEYBOARD_MOLE = "kebyard_mole";
@@ -47,18 +47,25 @@ BigMole.prototype = Object.create(Mole.prototype);
BigMole.constructor = BigMole;
function BigMole(x, y) {
Mole.call(this, x, y, BigMole.SCALE);
Mole.call(this, x, y, Mole.TYPE_BIG_MOLE);
this.anchor(0.5, 0);
}
BigMole.prototype.showUp = function() {
this.showUpTween(100);
this.showUpTween(BigMole.SHOW_UP_HEIGHT);
}
BigMole.prototype.changeColor = function(keyID) {
if(keyID == "KeyF" || keyID == "KeyJ")
this.mole.loadTexture("mole_peach");
else
this.mole.loadTexture("mole_grey");
}
BigMole.SCALE = 1;
BigMole.START_POS_Y = 200;
BigMole.SHOW_UP_POS_Y = 100;
BigMole.SHOW_UP_HEIGHT = 100;
BigMole.SHOW_UP_TIME_MS = 200;
@@ -72,7 +79,7 @@ KeyboardMole.constructor = KeyboardMole;
function KeyboardMole(keyboard) {
this.keyboard = keyboard;
Mole.call(this, 0, 0, KeyboardMole.SCALE);
Mole.call(this, 0, 0, Mole.TYPE_KEYBOARD_MOLE);
this.anchor(0, 0);
this.hide();
}
@@ -86,10 +93,19 @@ KeyboardMole.prototype.hide = function() {
}
KeyboardMole.prototype.moveToKey = function(text) {
var x = this.keyboard.getKeyPosX(text);
var y = this.keyboard.getKeyPosY(text);
var x = this.keyboard.getKeyPosX(text) + KeyboardMole.OFFSET_X;
var y = this.keyboard.getKeyPosY(text) + KeyboardMole.OFFSET_Y;
this.move(x, y);
}
KeyboardMole.prototype.changeColor = function(keyID) {
if(keyID == "KeyF" || keyID == "KeyJ")
this.mole.loadTexture("mole_peach_small");
else
this.mole.loadTexture("mole_grey_small");
}
KeyboardMole.SCALE = 0.5;
KeyboardMole.SCALE = 1.2;
KeyboardMole.OFFSET_X = 4;
KeyboardMole.OFFSET_Y = 0;