The 2D Zoom is failed in many projects. This is because there is no "common" divisor for the Z variable. In this project you can see two methods, one of which is the correct one to use for a project. That divisor makes sure that all sprites are at the same ratio for x, y, and z. If you click "see inside" there is an operator for calculating distance with three dimensions and the main script.
All done by me, @Duck2Man