MattYellen Posted June 27, 2016 Share Posted June 27, 2016 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 More sharing options...
hexus Posted June 27, 2016 Share Posted June 27, 2016 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 More sharing options...
MattYellen Posted June 27, 2016 Author Share Posted June 27, 2016 Hmm... Interesting. So do you think this is actually working as designed or is it just a bug that nobody's gotten around to fixing? If it's the latter I might take a stab at fixing it myself. Link to comment Share on other sites More sharing options...
Recommended Posts