This page describes the process of creating a moving camera and zoom system which always stays withing the boundaries of world map.
Problem
How can I help the player navigate through the map, so he can reach every tile in the world we have built?
Answer: By creating a camera movement, controlled by a mouse or keyboard in order to go around the map and add a zoom in/out functionality so the player can adjust how far he is from the map tiles.
The camera moves when the screen bounds are reached with the mouse pointer, or with the buttons for movement (UP, DOWN, LEFT, RIGHT)
#3 Camera zoom
Camera zoom
With scrolling on the mouse wheel, the player can zoom in and out.
#4 Camera clamping
Camera moving out of the tile sie bug
The fix is to clamp the camera to the size of the tilemap. (can be seen in Result)
#5 Adjusting the Camera with the other scripts
During the intro dialogue, the camera controlling script is disabled to prevent the player from moving around. However. stopping the script caused the camera to be further zoomed in because the method for the zoomHandle was not called still.
Intro Dialogue fix
Intro scene consistent zoom
The fix was quite easy, the method handling the zoom needed to be called in the Awake of the CameraFollow script, so it is called before the
Result
The result is a camera that can change the zoom (with some boundaries) and navigate the player around the map.
Zoom
Movement
Quality of the result
The camera is fully functional and since the development of the project has been continuing to be built on top with no problems considering the camera.
After user testing evaluation the properties could be easily adjusted via Serialized fields.
Serialized fields which can easily be adjusted
Next steps
In connection to the Camera movement, I consider no further implementation for the scope of this project. The values of the speed and moving steps could be adjusted after testing.