Jump to content

Bug when the camera is scaled and moved?


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:


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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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