Player shifts when camera moves


#1

Hello! I’ve scaled down my game to 0.75 and now when I move camera around, player’s position shifts. This is code from create function

    this.game.world.scale.setTo(0.75, 0.75);
    this.scale.scaleMode = Phaser.ScaleManager.RESIZE;

52254914-06c22080-2932-11e9-9f39-cc8f656c122e


#2

I think it happens because the sprite is scaled up or down the size of the world
Are you scaling your sprite ?


#3

No, i don’t do anything with sprite. Tilemap and sprite is scaled down automatically at game init.


#4

Are they both scaled with the same value or two diffrent ones


#5

I didn’t understand you. I just do this.game.world.scale.setTo(0.75, 0.75); at game init and both player and tilemap is scaled down. No more scale operations are performed.


#6

Sorry for the misunderstand, in fact you just shared a line of code and without more code I can’t understand how you did that it’s why I was asking more questions to clarify how you are coding your game, it was not clear how you scaled both the world and the sprite

I don’t know the solution, good luck

PS : Maybe you’ll have a better answer via https://phaser.io/shop/premium-support


#7

I’m not sure. Check the worldScale values of the objects to see if they’re the same.