Add: mole grey, mole peach, small moles
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 5.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.2 KiB |
@@ -336,13 +336,18 @@ var WhacAMole = {
|
|||||||
return;
|
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.keyboard.keyMapper.getKeyIDOfText(this.typingRandomLetters[this.typingIndex]);
|
||||||
|
|
||||||
|
var keyID = this.keyMapper.getKeyIDOfText(nextLetter);
|
||||||
|
// console.log(keyID);
|
||||||
|
this.bigMole.changeColor(keyID);
|
||||||
this.bigMole.showUp();
|
this.bigMole.showUp();
|
||||||
|
|
||||||
|
this.keyboardMole.changeColor(keyID);
|
||||||
this.keyboardMole.show();
|
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++) {
|
for(var i = 0; i < WhacAMole.TYPING_CONTENT_PREVIEW_COUNT; i++) {
|
||||||
|
|||||||
@@ -29,7 +29,10 @@ var Loading = {
|
|||||||
startLoading: function() {
|
startLoading: function() {
|
||||||
game.load.image('icon_fullscreen', '../../../resources/image/icon/fullscreen_white.png');
|
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');
|
// game.load.image('hand_left', '../../../resources/image/ui/hand_left.png');
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
function Mole(x, y, scale) {
|
function Mole(x, y, type) {
|
||||||
this.mole = game.add.image(x, y, "mole");
|
if(type == Mole.TYPE_BIG_MOLE) {
|
||||||
this.mole.scale.set(scale);
|
this.mole = game.add.image(x, y, "mole_grey");
|
||||||
// this.move(x, y);
|
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) {
|
Mole.prototype.alpha = function(value) {
|
||||||
@@ -23,21 +27,17 @@ Mole.prototype.anchor = function(x, y) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Mole.prototype.showUpTween = function(showUpHeight) {
|
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)
|
this.tween = game.add.tween(this.mole)
|
||||||
.from( { y: BigMole.START_POS_Y }, 10 )
|
// .from( { y: BigMole.START_POS_Y }, 10 )
|
||||||
.to( { y: BigMole.SHOW_UP_POS_Y }, BigMole.SHOW_UP_TIME_MS, "Quart.easeOut");
|
// .to( { y: BigMole.SHOW_UP_POS_Y }, BigMole.SHOW_UP_TIME_MS, "Quart.easeOut");
|
||||||
// .from( { y: this.posY }, 10 )
|
.from( { y: this.posY }, 10 )
|
||||||
// .to( { y: (this.posY + showUpHeight) }, BigMole.SHOW_UP_TIME_MS, "Quart.easeOut");
|
.to( { y: (this.posY - showUpHeight) }, BigMole.SHOW_UP_TIME_MS, "Quart.easeOut");
|
||||||
this.tween.start();
|
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;
|
BigMole.constructor = BigMole;
|
||||||
|
|
||||||
function BigMole(x, y) {
|
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);
|
this.anchor(0.5, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
BigMole.prototype.showUp = function() {
|
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.SCALE = 1;
|
||||||
BigMole.START_POS_Y = 200;
|
BigMole.START_POS_Y = 200;
|
||||||
BigMole.SHOW_UP_POS_Y = 100;
|
BigMole.SHOW_UP_HEIGHT = 100;
|
||||||
BigMole.SHOW_UP_TIME_MS = 200;
|
BigMole.SHOW_UP_TIME_MS = 200;
|
||||||
|
|
||||||
|
|
||||||
@@ -72,7 +79,7 @@ KeyboardMole.constructor = KeyboardMole;
|
|||||||
function KeyboardMole(keyboard) {
|
function KeyboardMole(keyboard) {
|
||||||
this.keyboard = 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.anchor(0, 0);
|
||||||
this.hide();
|
this.hide();
|
||||||
}
|
}
|
||||||
@@ -86,10 +93,19 @@ KeyboardMole.prototype.hide = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
KeyboardMole.prototype.moveToKey = function(text) {
|
KeyboardMole.prototype.moveToKey = function(text) {
|
||||||
var x = this.keyboard.getKeyPosX(text);
|
var x = this.keyboard.getKeyPosX(text) + KeyboardMole.OFFSET_X;
|
||||||
var y = this.keyboard.getKeyPosY(text);
|
var y = this.keyboard.getKeyPosY(text) + KeyboardMole.OFFSET_Y;
|
||||||
this.move(x, 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;
|
||||||
|
|||||||
Reference in New Issue
Block a user