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/forest1.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: 0.05,
lifespan: 800,
frequency: 30,
speed: 200
}
);
}
update() {}
}
const config = {
type: Phaser.AUTO,
width: 800,
height: 400,
scene: Example
};
const game = new Phaser.Game(config);
//activateControls(["LMB"]);