Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I really dig the way that the map is moved in Clash of Clans (https://itunes.apple.com/ca/app/clash-of-clans/id529479190?mt=8)...

I can recognize the pinch and finger movement needed for the zooming and the swiping around the map, what I'm looking for is a tutorial in any language that reveals how to test for the map going out of bounds when moved or scaled.

My google fu has failed so far on this one, any hints?

Right now I can perform the scale operations and the movement operations, but I can't figure out how to stop the map from going out of bounds when pinched or scaled. My code is a crazy mess and makes me think I'm missing the fundamental logic of how this is done.

(I am using Starling with AIR, but a tutorial in any language if you have a link).

Update: this is what I'm basing what I have currently so far: https://github.com/PrimaryFeather/Starling-Framework/blob/master/samples/demo/src/utils/TouchSheet.as

share|improve this question
2  
Instead of thinking about moving/scaling the map, perhaps it would help to think about moving/scaling the camera. –  Tetrad Mar 20 '13 at 20:19
    
Thanks @Tetrad but there is no "camera" to speak of; Starling mimics the standard Flash display hierarchy and what I'm talking about involves adding the pannable / scalable display objects to a parent object that you then pan and scale. I can do this, I just can't make it stop at the largest / smallest scale so it does not fly off of the screen. Yuck. Thanks again. –  antman Mar 20 '13 at 21:36
    
If that's the case then how will a tutorial in any language help? Something like this wouldn't necessarily be done in such a way using a different engine/language/tools/etc. Also, why are you unable to stop the scaling and movement? I don't know how what you're using works but I don't see why you can't define borders and not allow movement outside of them. –  Tony Mar 21 '13 at 19:39
    
Hi @Tony yes, obviously something with the Flash Display Hierarchy in mind would be best. However, the reason I'm asking is because I'm hung up on how to anticipate where the bounds of the Level should be considering the pivot point of the pinch gesture and the scale that it will be moving to. So, I'm asking for anything that could give me some clarity on that. –  antman Mar 22 '13 at 18:16
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.