If you're planning to create games in 2D, an important thing to master is how to use a camera, and that's what we'll do now.
Enter this code at the beginning of
Game:initialize () in
self.camera = MOAICamera2D.new ()
(self.layer:setViewport ( viewport )), add the following line of code:
self.layer:setCamera ( self.camera )
This binds the layer to that camera. And that's it; when you move the camera, you'll see that the viewport will follow, and if you scale the camera up and down, it will zoom in and zoom out accordingly. We'll write a few lines to demonstrate ...