I am just starting in game development (with web programming background). I want to know how to create 2D game with camera that can zoom in/out and can be moved like map in Google Maps. Could you help me with advise where to look for this, please? Thank you
closed as not a real question by akled, Trevor Powell, Byte56♦, Josh Petrie♦, bummzack Dec 16 '12 at 13:18
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.
If you have have a way of resizing your canvas, you can implement this easily.
Then, when you are rendering it, call this:
You can now move your camera around the world, without actually moving the world.
And for zooming... You must have a way of scaling your entire canvas, before/after of rendering anything:
There are different implementations of the
In most implementations, though, you'd want to save the state of the canvas, scale, render, and then load the state back. Why? Because scaling with a factor of 0.5 two times in a row wouldn't give you a picture two times larger, but a picture 4 times larger. You're not setting a constant scaling factor by calling
I suggest you don't scale every frame though. Scale only if the