Jump to content

Phaser emitter fixedToCamera not working correctly on mobile


tikitaka
 Share

Recommended Posts

I have a rain snow emitter inside my game that is fixed to the camera:

 

    snowflakeEmitter = game.add.emitter(0, 0, 500);
	snowflakeEmitter.makeParticles('snowFlake');
	snowflakeEmitter.fixedToCamera = true;
	snowflakeEmitter.setYSpeed(50, 80);
	snowflakeEmitter.setXSpeed(-20, 20);
	snowflakeEmitter.gravity = 0;
	snowflakeEmitter.scale.setTo(pixelRatio);
	snowflakeEmitter.width = game.world.width * 2;
	snowflakeEmitter.start(false, 8000, 200);

 

As I climb higher, so does the emitter, but for some reason it climbs at a much faster pace (speficially on mobile) so it doesn't stay with the top left corner of the screen as my character moves forward ( up the screen). I know this because I set the cameraOffset.y initially halfway down the screen to see why the particles were just disappearing after I moved forward a decent amount - they were disappearing because they were timing out. 

 

It doesn't disappear on my desktop, but I'm not sure if it's because I have a lower devicePixelRatio than I do on my phone. Either way, when I add a sprite and set fixedToCamera to true, it works as intended on all devices. Any suggestions?

 

Thanks!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...