Jump to content

Constrain player sprite to camera


bobonthenet
 Share

Recommended Posts

Is there an easy way to make the player sprite collide with the edge of the camera? I'm using Matterjs physics. My game is a space shooter with an automatically scrolling camera that gradually moves from left to right across a tilemap level. Right now it is very easy to accidentally move the player outside of the viewable area. When that happens the player easily gets lost and it is hard to find your way back to the viewable area. I was thinking I could remedy this by automatically adjusting the player's velocity to match the camera scroll speed when the edge of the camera is reached. I know that would work but before I do that I would like to know if there is a simpler technique I could use.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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