Jump to content

worldBounds do not work on moving camera


deleo
 Share

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,

Jur

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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