Add: stove dial, heat plate
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
God = function(x, y, mainGame) {
|
||||
God.prototype = Object.create(Phaser.Sprite.prototype);
|
||||
God.prototype.constructor = God;
|
||||
|
||||
function God(x, y, mainGame) {
|
||||
this.mainGame = mainGame;
|
||||
this.isActivated = true;
|
||||
|
||||
@@ -11,10 +14,44 @@ God = function(x, y, mainGame) {
|
||||
// this.events.onInputDown.add(this.onDown, this);
|
||||
|
||||
game.add.existing(this);
|
||||
|
||||
game.physics.startSystem(Phaser.Physics.ARCADE);
|
||||
|
||||
this.fullHeartEmitter = game.add.emitter(x, y - 150, 20);
|
||||
this.fullHeartEmitter.makeParticles("heart_full");
|
||||
this.fullHeartEmitter.minParticleScale = 0.5;
|
||||
this.fullHeartEmitter.maxParticleScale = 0.7;
|
||||
this.fullHeartEmitter.minParticleSpeed.setTo(-150, -700);
|
||||
this.fullHeartEmitter.maxParticleSpeed.setTo(150, -500);
|
||||
this.fullHeartEmitter.gravity = 1500;
|
||||
|
||||
this.emptyHeartEmitter = game.add.emitter(x, y - 150, 20);
|
||||
this.emptyHeartEmitter.makeParticles("heart_empty");
|
||||
this.emptyHeartEmitter.minParticleScale = 0.5;
|
||||
this.emptyHeartEmitter.maxParticleScale = 0.7;
|
||||
this.emptyHeartEmitter.minParticleSpeed.setTo(-150, -700);
|
||||
this.emptyHeartEmitter.maxParticleSpeed.setTo(150, -500);
|
||||
this.emptyHeartEmitter.gravity = 1500;
|
||||
|
||||
this.angryEmitter = game.add.emitter(x, y - 200, 20);
|
||||
this.angryEmitter.makeParticles("smoke");
|
||||
this.angryEmitter.width = 30;
|
||||
this.angryEmitter.height = 30;
|
||||
this.angryEmitter.setRotation(-90, 90);
|
||||
this.angryEmitter.setAlpha(0.1, 0.3);
|
||||
// this.angryEmitter.setScale(0.2, 0.2);
|
||||
this.angryEmitter.minParticleScale = 0.5;
|
||||
this.angryEmitter.maxParticleScale = 1;
|
||||
this.angryEmitter.gravity = -300;
|
||||
|
||||
this.angryEmitter.forEach(
|
||||
function(particle) {
|
||||
particle.tint = 0xf0f0f0;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
God.prototype = Object.create(Phaser.Sprite.prototype);
|
||||
God.prototype.constructor = God;
|
||||
|
||||
God.prototype.update = function() {
|
||||
}
|
||||
|
||||
@@ -48,6 +85,8 @@ God.prototype.animateHappy = function(type) {
|
||||
// tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Linear.None, true, 0);
|
||||
tween.onComplete.add(this.smileAgain, this);
|
||||
tween.start();
|
||||
|
||||
this.particleBurst(God.REACTION_HAPPY);
|
||||
}
|
||||
|
||||
God.prototype.animateAngry = function(type) {
|
||||
@@ -60,9 +99,39 @@ God.prototype.animateAngry = function(type) {
|
||||
// tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Linear.None, true, 0);
|
||||
tween.onComplete.add(this.smileAgain, this);
|
||||
tween.start();
|
||||
|
||||
this.particleBurst(God.REACTION_ANGRY);
|
||||
}
|
||||
|
||||
God.prototype.smileAgain = function() {
|
||||
this.scale.set(0.5);
|
||||
this.loadTexture('god_smile');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
God.prototype.particleBurst = function(reaction) {
|
||||
// if(this.fullHeartEmitter.on)
|
||||
// this.fullHeartEmitter.on = false;
|
||||
|
||||
// if(this.emptyHeartEmitter.on)
|
||||
// this.emptyHeartEmitter.on = false;
|
||||
|
||||
switch(reaction) {
|
||||
case God.REACTION_HAPPY:
|
||||
this.fullHeartEmitter.start(true, 900, 100, 15, true);
|
||||
break;
|
||||
|
||||
case God.REACTION_SMILE:
|
||||
this.emptyHeartEmitter.start(true, 900, 100, 15, true);
|
||||
break;
|
||||
|
||||
case God.REACTION_ANGRY:
|
||||
this.angryEmitter.start(true, 900, 100, 15, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
God.REACTION_HAPPY = 0;
|
||||
God.REACTION_SMILE = 1;
|
||||
God.REACTION_ANGRY = 2;
|
||||
Reference in New Issue
Block a user