I’ve just started my jurney with phaser with this tutorial https://phaser.io/tutorials/making-your-first-phaser-3-game/part1 . After completion I decided to change the character sprite. Unfortunately the spritesheet I’ve downloaded had frames of run animation only in one direction. I thought “No big deal I will just flip it”. And I did tried to do so like that:
if (cursors.left.isDown)
{
player.scaleX = 1;
player.setVelocityX(-160);
player.anims.play('run', true);
}
else if (cursors.right.isDown)
{
player.scaleX = -1;
player.setVelocityX(160);
player.anims.play('run', true);
}
At first it seems to work, animation changes direction as expected but:
The game physics thinks my player is wider and detects collisions wrongly. I should just fall on the ground in the situation presented on the image, I can’t reach the wall nad collisions with the stars are occuring also way too soon. What is the couse of this behavior? What is the right way to “flip” the animation?