-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit pan in my scene #17
Comments
I haven't implemented anything to automatically limit panning because that will be very specific to your game, but check out the included |
I will try this! Thanks!! |
This was my logic for an older version of SKTiled when cameraPanned was able to be overridden. But perhaps some of the math can help out:
It handles zooming, and if the map is bigger than the screen, the map locks to the edges of the screen as you pan. It also handles if the map is smaller than the screen, the edges act as bumpers. |
Hi, I have another question.
Can I limit the pan in my scene?
I can pan infinitly and I want to use only the region of my tiles and a little of the border of the tiles.
I tried this way:
if position.x < 68 { position.x = 68 }
if position.x > 108 { position.x = 108 }
if position.y < 30 { position.y = 30 }
if position.y > 50 { position.y = 50 }
But when I zoom the camera, this positions change and It does not work properly anymore.
My tile map is little, about 7x4, and there is some pictures at its side, so it is pratically my workspace.
Is there a way to limit the pan to this little area, and be able to zoom limiting this same area?
Thanks!
The text was updated successfully, but these errors were encountered: