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

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.

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

Loading...
 Share

  • Recently Browsing   0 members

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