forked from mileung/PhaserDemo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
state6.js
33 lines (29 loc) · 975 Bytes
/
state6.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
demo.state6 = function(){};
demo.state6.prototype = {
preload: function(){
game.load.image('volcano', 'assets/sprites/volcano.png');
game.load.image('redBall', 'assets/sprites/redBall.png');
game.load.image('orBall', 'assets/sprites/orBall.png');
},
create: function(){
game.stage.backgroundColor = '#cc6699';
addChangeStateEventListeners();
game.add.sprite(centerX, 1000, 'volcano').anchor.setTo(0.5, 1);
var emitter = game.add.emitter(centerX, 500, 2000);
emitter.makeParticles(['redBall', 'orBall'], 0, 5000, false, true);
emitter.maxParticleSpeed.set(300, -300);
emitter.minParticleSpeed.set(-300, -100);
emitter.gravity = 300;
game.time.events.add(2000, function() {
emitter.start(false, 5000, 20);
game.time.events.loop(500, function() {
if (emitter.on) {
emitter.on = false;
} else {
emitter.on = true;
}
});
});
},
update: function(){}
};