Say that I have two characters which can move on their own. To zoom the camera based on on their distance, add this event :
Run the layout, and you can see that the layout is zooming smoothly.
Just like I said before, we need to modify LayoutScale. You got it.
To get the correct scale, we need to divide WindowHeight (for landscape view) or WindowWidth (for portrait view) with player distance.
Window Size = 640x480
Current layout scale = 1
Current distance = 300
What is the scale if the distance is now 600?
Scale = 480/600 --> 0.8
NEXT THING TO DO
Limit the scalling to get more control.
For instance, do it only when character distance is longer than 300, and less than 700.
if you like this tutorial, please like my