Hey guys... sorry, stuck again!
The drag & drop map position from ROJO worked well, until I tried to scroll to a sprite, basically a map marker of where the user currently is. Want the map to start off centralised where the user is.
For some reason, if I do that on layout load (even with a 0.5 sec delay) it messes up the edges and I then cant scroll far enough left, and it goes too far right...if its a manual button press action it works, but not well - if the sprite is out of the viewport it only scrolls to the far edge of the sprite.
So, I tried the simplified calminthenight code from ROJO - works! Doesn't mess up the edges when I use "scroll to", and nicely puts the marker in the centre!
BUT...
That code doesn't restrict the edges at all, and you can scroll right off the map...
I tried using clamp, and now have this:
This does limit the scrolling but goes way off the edges still - I think it's to do with "scroll to"'s behaviour and the centre camera? The scroll to seems to put the sprite exactly in the centre of the view so is there another half distance x and y or something like that I need to factor in..?!
TIA!
Ross