Hello Guest

Author Topic: Preventing the Camera From Moving Beyond Level Boundaries  (Read 4050 times)

AbsurdInteractive

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 16
    • View Profile
Preventing the Camera From Moving Beyond Level Boundaries
« 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?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Preventing the Camera From Moving Beyond Level Boundaries
« Reply #1 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.