2D Toolkit Forum

2D Toolkit => Support => Topic started by: AbsurdInteractive on July 31, 2013, 04:26:02 am

Title: Preventing the Camera From Moving Beyond Level Boundaries
Post by: AbsurdInteractive on July 31, 2013, 04:26:02 am
Currently, we have the 2D Toolkit camera centered on the player, but we would like to prevent the camera from moving past the level boundaries, and were wondering what ma be the best way to implement this with 2D toolkit's camera?
Title: Re: Preventing the Camera From Moving Beyond Level Boundaries
Post by: unikronsoftware on July 31, 2013, 10:48:37 am
It'll be exactly the same as any normal camera. There are little helper functions in tk2dCamera that makes it a bit easier to deal with -
tk2dCamera.ScreenExtents (tk2d 2.1 only) gives you the screen rect. You can use this to decide how far to move the camera before you'll be viewing outside the level boundaries.