mirror of
https://github.com/photonstorm/phaser
synced 2024-12-24 03:53:28 +00:00
25 lines
667 B
JavaScript
25 lines
667 B
JavaScript
|
|
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });
|
|
|
|
var emitter;
|
|
|
|
function preload() {
|
|
|
|
game.load.image('carrot', 'assets/sprites/carrot.png');
|
|
game.load.image('star', 'assets/misc/star_particle.png');
|
|
game.load.image('diamond', 'assets/sprites/diamond.png');
|
|
|
|
}
|
|
|
|
function create() {
|
|
|
|
game.stage.backgroundColor = 0x337799;
|
|
|
|
emitter = game.add.emitter(game.world.centerX, 200, 200);
|
|
|
|
// Here we're passing an array of image keys. It will pick one at random when emitting a new particle.
|
|
emitter.makeParticles(['diamond', 'carrot', 'star']);
|
|
|
|
emitter.start(false, 5000, 20);
|
|
|
|
}
|