Hi,
When i use particle and CANVAS mode and set a specific zoom with my camera, the particle’s position
is not correct.
I have follow this solution :
However when i use it in my example, that’s not true.
I have find another solution with camera.getWorldPoint…but it don’t works also
Could you help me please ?
https://codepen.io/ogames/pen/KKKxbZx
var config = {
type: Phaser.CANVAS,
width: 800,
height: 600,
parent: 'phaser-example',
physics: {
default: 'arcade',
arcade: {
gravity: { y: 200 }
}
},
scene: {
preload: preload,
create: create,
update: update
}
};
var cam;
var out;
var logo;
var particles;
var create_camera;
create_camera = (g) => {
cam = g.cameras.add(0, 0, 800, 600).setZoom(.2)
//cam.rotation = 15
}
var game = new Phaser.Game(config);
function preload ()
{
this.load.image('logo', 'https://i.postimg.cc/NMQC094p/particle-catch.png');
this.load.image('red','https://i.postimg.cc/wMZ26BFB/particle-blue.png')
}
function create ()
{
create_camera(this)
particles = this.add.particles('red');
var emitter = particles.createEmitter({
speed: 100,
scale: { start: 1, end: 0 },
blendMode: 'ADD'
});
logo = this.physics.add.image(400, 100, 'logo');
logo.setVelocity(100, 200);
logo.setBounce(1, 1);
logo.setCollideWorldBounds(true);
//emitter.startFollow(logo);
}
function update(){
out = cam.getWorldPoint(logo.x,logo.y)
particles.setPosition(out.x,out.y)
//particles.setPosition(logo.x,logo.y)
}