class Example extends Phaser.Scene {
preload() {
// https://www.kenney.nl/assets/particle-pack
// https://qdanp.itch.io/forest-stage-escenario-bosque
this.load.image(
"particleTexture",
"https://assets.codepen.io/9367036/circle_05.png"
);
this.load.image("bg", "https://assets.codepen.io/9367036/forest2.jpg");
}
create() {
let background = this.add.image(0, 0, "bg").setOrigin(0, 0);
background.displayWidth = config.width;
background.displayHeight = config.height;
this.emitter = this.add.particles(
config.width / 2,
config.height / 2,
"particleTexture",
{
scale: { start: 0.4, end: 0, random: true },
lifespan: 1000,
frequency: 10,
gravityY: 1000,
speed: { min: 100, max: 400 },
blendMode: "ADD"
}
);
}
update() {}
}
const config = {
type: Phaser.AUTO,
width: 800,
height: 400,
scene: Example
};
const game = new Phaser.Game(config);
//activateControls(["LMB"]);