Fix: refactoring source codes
This commit is contained in:
@@ -83,19 +83,12 @@ God.prototype.makeParticles = function() {
|
||||
);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -105,6 +98,21 @@ God.prototype.setScale = function(size) {
|
||||
this.backupScale = size;
|
||||
}
|
||||
|
||||
God.prototype.isOver = function(x, y) {
|
||||
var halfWidth = (this.width - God.OUT_OF_FACE_WIDTH) / 2;
|
||||
var halfHeight = this.height / 2;
|
||||
if(x < this.x - halfWidth)
|
||||
return false;
|
||||
else if(this.x + halfWidth < x)
|
||||
return false;
|
||||
else if(y < this.y - this.height + God.OUT_OF_FACE_HEIGHT)
|
||||
return false;
|
||||
else if(this.y - God.OUT_OF_FACE_HEIGHT < y)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
God.prototype.animateHappy = function(meat) {
|
||||
this.speechBubble.showSpeechBubble(meat);
|
||||
@@ -184,6 +192,10 @@ God.POSITION_Y = 340;
|
||||
God.HEAD_WIDTH = 80;
|
||||
God.HEAD_HEIGHT = 30;
|
||||
|
||||
God.OUT_OF_FACE_WIDTH = 30;
|
||||
God.OUT_OF_FACE_HEIGHT = 30;
|
||||
|
||||
|
||||
God.EFFECT_LIFE_TIME_MS = 1200;
|
||||
|
||||
God.REACTION_HAPPY = 0;
|
||||
|
||||
Reference in New Issue
Block a user