Jump to content

Bug when the camera is scaled and moved?


MattYellen
 Share

Recommended Posts

I think I found a bug.  If you have Tilemap and a Sprite in the same game, and a camera that is scaled, when the camera is moved the tilemap and sprite don't stay aligned.  I'm guessing the position of one or the other is not getting updated correctly based on the camera scale.

This is easier to explain with an example.  Fortunately it's easy to reproduce by modifying one of the Phaser examples.  Just start with the "Mario" Tilemap example:

http://phaser.io/examples/v2/tilemaps/mario#gv

Then add the following lines to the end of the "create()" method:

    game.add.sprite(490, 165, 'player');
    game.camera.scale.x = 1.5;
    game.camera.scale.y = 1.5;

Run this and move the camera to the right.  Notice how the sprite and tilemap background don't stay aligned.

Link to comment
Share on other sites

Yep, this bothers me too. It's always worked this way apparently, and wasn't built with proper zoom functionality intended, but in my mind if you scale a camera it shouldn't behave like this. A camera should define a consistent perspective into the world.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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