Jump to content

Camera follow when world bounds are changed?


Julia
 Share

Recommended Posts

Hey,

 

I'm working on a vertical platformer game. The camera following the player worked fine, until I changed my world bounds to start at the bottom of the world and the player going up (first the world started at 0, 0). My player can jump, but the camera won't follow anymore. I've searched a lot about it but nothing could help me further. 

 

I'm just using: 

game.camera.follow(player);

Hope anyone can help!

Link to comment
Share on other sites

It sounds like the camera is reaching the upper bounds. Rather than change the origin of the world, just change the height of the world and start your player at game.world.height - <distance from bottom> and it should work fine. You may have to adjust the placement of your objects but the correct way to do this would be to always use a sensible point of reference (in this case the bottom of the world via game.world.height) so you can adjust things easily.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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