views:

58

answers:

1

What's the best way to implement a pan-able zoomable game map with Cocos2d for iPhone. It would be like Mobile Safari except with a game map that doesn't fit completely on screen. Or like how it's done with Angry Birds, Cut the rope, etc.

This would not be a side scrolling game, just a fixed game area that you can zoom in/out of.

I'm new so if there are tutorials for this that would be great.

Thanks

+2  A: 

if you are not going to use Physics in your game, then its very simple you will find a lot of tutorials on zoom/pan , just set your world SCALE in the touchesMoved zoom/pan code.

but if you are going for Angry Bird like stuff, then you can use the Box2d/Chipmunk physics engine(comes with cocos2d), but for building the Physics world like Angry birds you will either have to write your own Level Editor or you can use LevelSVG(by Cocos2d people) kindof thing to visually make the world in SVG editor and Parse it to BOX2d.

As for the Zoom/pan with Physics bodies in your world, it will work as long as your Physics world is in your LAYER which you are trying to SCALE.

but i ll recommend Overwriting the VISIT function of your Layer you want to Scale, and handle the Scaling by either glOrthof or glScalef

Shohair