Add: particle effect
This commit is contained in:
@@ -2,13 +2,18 @@ God.prototype = Object.create(Phaser.Sprite.prototype);
|
|||||||
God.constructor = God;
|
God.constructor = God;
|
||||||
|
|
||||||
function God() {
|
function God() {
|
||||||
this.isActivated = true;
|
|
||||||
|
|
||||||
Phaser.Sprite.call(this, game, GAME_SCREEN_SIZE.x / 2, GAME_SCREEN_SIZE.y - 50, 'god_smile');
|
Phaser.Sprite.call(this, game, GAME_SCREEN_SIZE.x / 2, GAME_SCREEN_SIZE.y - 50, 'god_smile');
|
||||||
this.anchor.setTo(0.5, 1);
|
this.anchor.setTo(0.5, 1);
|
||||||
this.scale.set(0.5);
|
this.scale.set(0.5);
|
||||||
|
|
||||||
game.add.existing(this);
|
game.add.existing(this);
|
||||||
|
|
||||||
|
game.physics.startSystem(Phaser.Physics.ARCADE);
|
||||||
|
|
||||||
|
// this.emitter.x = GAME_SCREEN_SIZE.x / 2;
|
||||||
|
this.emitter = game.add.emitter(GAME_SCREEN_SIZE.x / 2, 0);
|
||||||
|
this.emitter.makeParticles("tile_choco");
|
||||||
|
this.emitter.gravity = 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
God.prototype.setScale = function(size) {
|
God.prototype.setScale = function(size) {
|
||||||
@@ -22,11 +27,13 @@ God.prototype.animateBigHappy = function(type) {
|
|||||||
|
|
||||||
var tween = game.add.tween(this.scale);
|
var tween = game.add.tween(this.scale);
|
||||||
// tween.to({x:0.7, y:0.7}, 500, Phaser.Easing.Quadratic.Out, true, 0);
|
// tween.to({x:0.7, y:0.7}, 500, Phaser.Easing.Quadratic.Out, true, 0);
|
||||||
tween.to({x:1, y:1}, 1000, Phaser.Easing.Bounce.Out, true, 0);
|
tween.to({x:1, y:1}, 1500, Phaser.Easing.Bounce.Out, true, 0);
|
||||||
// tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Elastic.InOut, true, 0, 2, true);
|
// tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Elastic.InOut, true, 0, 2, true);
|
||||||
// tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Linear.None, true, 0);
|
// tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Linear.None, true, 0);
|
||||||
tween.onComplete.add(this.smileAgain, this);
|
tween.onComplete.add(this.smileAgain, this);
|
||||||
tween.start();
|
tween.start();
|
||||||
|
|
||||||
|
this.particleBurst("BigHappy");
|
||||||
}
|
}
|
||||||
|
|
||||||
God.prototype.animateBigSmile = function(type) {
|
God.prototype.animateBigSmile = function(type) {
|
||||||
@@ -39,6 +46,8 @@ God.prototype.animateBigSmile = function(type) {
|
|||||||
// tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Linear.None, true, 0);
|
// tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Linear.None, true, 0);
|
||||||
tween.onComplete.add(this.smileAgain, this);
|
tween.onComplete.add(this.smileAgain, this);
|
||||||
tween.start();
|
tween.start();
|
||||||
|
|
||||||
|
this.particleBurst("BigSmile");
|
||||||
}
|
}
|
||||||
|
|
||||||
God.prototype.animateLittleSmile = function(type) {
|
God.prototype.animateLittleSmile = function(type) {
|
||||||
@@ -51,6 +60,8 @@ God.prototype.animateLittleSmile = function(type) {
|
|||||||
// tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Linear.None, true, 0);
|
// tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Linear.None, true, 0);
|
||||||
tween.onComplete.add(this.smileAgain, this);
|
tween.onComplete.add(this.smileAgain, this);
|
||||||
tween.start();
|
tween.start();
|
||||||
|
|
||||||
|
this.particleBurst("LittleSmile");
|
||||||
}
|
}
|
||||||
|
|
||||||
God.prototype.animateBigAngry = function(type) {
|
God.prototype.animateBigAngry = function(type) {
|
||||||
@@ -81,3 +92,32 @@ God.prototype.smileAgain = function() {
|
|||||||
this.scale.set(0.5);
|
this.scale.set(0.5);
|
||||||
this.loadTexture('god_smile');
|
this.loadTexture('god_smile');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
God.prototype.particleBurst = function(grade) {
|
||||||
|
switch(grade) {
|
||||||
|
case "BigHappy":
|
||||||
|
this.emitter.y = GAME_SCREEN_SIZE.y - 350;
|
||||||
|
this.emitter.setYSpeed(-700);
|
||||||
|
this.emitter.minParticleScale = 1.3;
|
||||||
|
this.emitter.minParticleScale = 1.5;
|
||||||
|
this.emitter.start(true, 5000, null, 50);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "BigSmile":
|
||||||
|
this.emitter.y = GAME_SCREEN_SIZE.y - 250;
|
||||||
|
this.emitter.setYSpeed(-600);
|
||||||
|
this.emitter.minParticleScale = 1.1;
|
||||||
|
this.emitter.minParticleScale = 1.3;
|
||||||
|
this.emitter.start(true, 5000, null, 20);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "LittleSmile":
|
||||||
|
this.emitter.y = GAME_SCREEN_SIZE.y - 200;
|
||||||
|
this.emitter.setYSpeed(-500);
|
||||||
|
this.emitter.minParticleScale = 1;
|
||||||
|
this.emitter.minParticleScale = 1.1;
|
||||||
|
this.emitter.start(true, 5000, null, 10);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,6 +11,10 @@ JustOnTime.prototype.preload = function() {
|
|||||||
game.load.image('god_smile', '../../../resources/image/character/god/god_smile.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');
|
game.load.image('god_happy', '../../../resources/image/character/god/god_happy.png');
|
||||||
|
|
||||||
|
game.load.image('tile_choco', '../../../resources/image/background/tile_choco.png');
|
||||||
|
game.load.image('heart_full', '../../../resources/image/ui/heart_full.png');
|
||||||
|
game.load.image('heart_empty', '../../../resources/image/ui/heart_empty.png');
|
||||||
|
|
||||||
game.load.script('webfont', '//ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js');
|
game.load.script('webfont', '//ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user