Understanding map navigation
Now that we have our tile map loaded and enemies and coins dynamically added to the map, we can fix the navigation so we can wander around the map. But before we do that, let's talk about cameras and how we use them in our game.
A camera allows us to change what we see on the screen, which is very useful when you have a map that is larger than the physical screen. We can use this to do the following:
- Zoom the camera to show more or less of the map.
- Show a different part of the map than George's current location on the map.
- Move to a different part of the map using animation for a smooth transition.
- Link the camera's position to follow George, so that when George moves around the map, the camera updates and George stays visible, and the map moves around his position.
Most games use a combination of these, but it is the last point we are most interested in, as we want the camera to follow George as he moves around...