Direct Value Particle Emitter
Demonstrates a basic particle emitter using constant numeric values for properties like speed, lifespan, and gravity.
800 × 600
class Example extends Phaser.Scene
{
preload ()
{
this.load.setBaseURL('https://cdn.phaserfiles.com/v410');
this.load.image('star', 'assets/demoscene/star3.png');
}
create ()
{
this.add.particles(400, 200, 'star', {
speed: 100,
lifespan: 3000,
gravityY: 200
});
}
}
const config = {
scale: { mode: Phaser.Scale.FIT },
type: Phaser.AUTO,
width: 800,
height: 600,
backgroundColor: '#000',
parent: 'game-container',
scene: Example
};
const game = new Phaser.Game(config);