Jump to content

worldBounds do not work on moving camera


Recommended Posts

I have a sidescroller world in which the camera always moves to the right at the same pace. It forces the user to move along with it, because the player cannot move outside of the camera bounds. I have tried doing it like this:
this.game.world.setBounds(this.game.camera.x, 0, this.game.camera.x + this.camera.width, this.game.height - 60); in my update function
and this works well enough for the left side of the camera but not the right.
WHen I set the world width to game.camera.width - 1, the camera can no longer move but the bounds do work. 
Does anybody have an idea of what I am doing wrong?Best regards,


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...