edb8b43020
Fix: chocoball color Fix: history, ranking DB
76 lines
1.8 KiB
JavaScript
76 lines
1.8 KiB
JavaScript
God = function(x, y, mainGame) {
|
|
this.mainGame = mainGame;
|
|
this.isActivated = true;
|
|
|
|
Phaser.Sprite.call(this, game, x, y, 'god_angry');
|
|
// this.anchor.setTo(0.5, 1);
|
|
this.anchor.setTo(0.5, 1);
|
|
this.scale.set(0.5);
|
|
|
|
this.inputEnabled = false;
|
|
// this.input.enableDrag(false);
|
|
// this.events.onInputDown.add(this.onDown, this);
|
|
|
|
game.add.existing(this);
|
|
|
|
this.smileAgain();
|
|
}
|
|
|
|
God.prototype = Object.create(Phaser.Sprite.prototype);
|
|
God.prototype.constructor = God;
|
|
God.prototype.update = function() {
|
|
}
|
|
|
|
|
|
God.prototype.onDown = function(sprite, pointer) {
|
|
console.log("onDown : " + pointer.x + ", " + pointer.y);
|
|
this.animateAngry();
|
|
}
|
|
|
|
God.prototype.isInRect = function(x, y) {
|
|
return true;
|
|
}
|
|
|
|
God.prototype.onDragStop = function(sprite, pointer) {
|
|
console.log("onDragStop : " + pointer.x + ", " + pointer.y);
|
|
}
|
|
|
|
God.prototype.setScale = function(size) {
|
|
this.scale.set(size);
|
|
this.backupScale = size;
|
|
}
|
|
|
|
|
|
God.prototype.animateHappy = function() {
|
|
this.loadTexture('god_happy');
|
|
|
|
var tween = game.add.tween(this.scale);
|
|
tween.to({y:0.52}, 500, Phaser.Easing.Quadratic.Out, true, 0);
|
|
tween.onComplete.add(this.smileAgain, this);
|
|
tween.start();
|
|
}
|
|
|
|
God.prototype.animateAngry = function() {
|
|
this.loadTexture('god_angry');
|
|
|
|
var tween = game.add.tween(this.scale);
|
|
tween.to({x:0.55}, 500, Phaser.Easing.Bounce.Out, true, 0);
|
|
tween.onComplete.add(this.smileAgain, this);
|
|
tween.start();
|
|
}
|
|
|
|
God.prototype.smileAgain = function() {
|
|
this.scale.set(0.5);
|
|
this.loadTexture('god_smile');
|
|
}
|
|
|
|
|
|
God.loadResources = function() {
|
|
game.load.image('god_angry', '../../../resources/image/character/god/god_hungry.png');
|
|
game.load.image('god_smile', '../../../resources/image/character/god/god_smile.png');
|
|
game.load.image('god_happy', '../../../resources/image/character/god/god_happy.png');
|
|
|
|
}
|
|
|
|
God.POSITION_X = 800;
|
|
God.POSITION_Y = 560; |