2013-05-31 18:28:16 +00:00
|
|
|
/// <reference path="../../Phaser/Game.ts" />
|
|
|
|
(function () {
|
2013-08-08 03:35:13 +00:00
|
|
|
var game = new Phaser.Game(this, 'game', 800, 600, preload, create, update);
|
2013-08-09 04:08:54 +00:00
|
|
|
|
2013-05-31 18:28:16 +00:00
|
|
|
var emitter1;
|
|
|
|
var emitter2;
|
|
|
|
var emitter3;
|
|
|
|
var emitter4;
|
|
|
|
var emitter5;
|
|
|
|
var emitter6;
|
2013-08-09 04:08:54 +00:00
|
|
|
|
2013-08-08 03:35:13 +00:00
|
|
|
function preload() {
|
2013-06-05 01:58:16 +00:00
|
|
|
game.load.image('ball1', 'assets/sprites/aqua_ball.png');
|
|
|
|
game.load.image('ball2', 'assets/sprites/yellow_ball.png');
|
|
|
|
game.load.image('ball3', 'assets/sprites/red_ball.png');
|
|
|
|
game.load.image('ball4', 'assets/sprites/purple_ball.png');
|
|
|
|
game.load.image('ball5', 'assets/sprites/blue_ball.png');
|
|
|
|
game.load.image('ball6', 'assets/sprites/green_ball.png');
|
2013-05-31 18:28:16 +00:00
|
|
|
}
|
2013-08-09 04:08:54 +00:00
|
|
|
|
2013-05-31 18:28:16 +00:00
|
|
|
function makeEmitter(emitter, x, y, graphic) {
|
|
|
|
emitter = game.add.emitter(x, y);
|
|
|
|
emitter.gravity = 100;
|
|
|
|
emitter.bounce = 0.5;
|
2013-08-09 04:08:54 +00:00
|
|
|
|
|
|
|
if (x == 0) {
|
2013-05-31 18:28:16 +00:00
|
|
|
emitter.setXSpeed(200, 250);
|
|
|
|
} else {
|
|
|
|
emitter.setXSpeed(-200, -250);
|
|
|
|
}
|
2013-08-09 04:08:54 +00:00
|
|
|
|
2013-05-31 18:28:16 +00:00
|
|
|
emitter.setYSpeed(-50, -10);
|
|
|
|
emitter.makeParticles(graphic, 250, false, 0);
|
2013-08-09 04:08:54 +00:00
|
|
|
|
2013-05-31 18:28:16 +00:00
|
|
|
return emitter;
|
|
|
|
}
|
2013-08-09 04:08:54 +00:00
|
|
|
|
2013-05-31 18:28:16 +00:00
|
|
|
function create() {
|
|
|
|
emitter1 = makeEmitter(emitter1, 0, 50, 'ball1');
|
|
|
|
emitter2 = makeEmitter(emitter2, 0, 250, 'ball2');
|
|
|
|
emitter3 = makeEmitter(emitter3, 0, 450, 'ball3');
|
|
|
|
emitter4 = makeEmitter(emitter4, game.stage.width, 50, 'ball4');
|
|
|
|
emitter5 = makeEmitter(emitter5, game.stage.width, 250, 'ball5');
|
|
|
|
emitter6 = makeEmitter(emitter6, game.stage.width, 450, 'ball6');
|
2013-08-09 04:08:54 +00:00
|
|
|
|
2013-05-31 18:28:16 +00:00
|
|
|
emitter1.start(false, 50, 0.05);
|
|
|
|
emitter2.start(false, 50, 0.05);
|
|
|
|
emitter3.start(false, 50, 0.05);
|
|
|
|
emitter4.start(false, 50, 0.05);
|
|
|
|
emitter5.start(false, 50, 0.05);
|
|
|
|
emitter6.start(false, 50, 0.05);
|
|
|
|
}
|
2013-08-09 04:08:54 +00:00
|
|
|
|
2013-05-31 18:28:16 +00:00
|
|
|
function update() {
|
|
|
|
//game.collide(leftEmitter, rightEmitter);
|
2013-08-09 04:08:54 +00:00
|
|
|
}
|
2013-05-31 18:28:16 +00:00
|
|
|
})();
|