Z

The variable 'z' can be used in 3D games for various reason, such as, jumping, crouching, moving up elevators and much, much more.

How the variable 'z' is initialized
To initialize z, in a create event, code:

{   z1 = 0 z2 = 10 }

z1 is the bottom of the respective object and z2 is the top. In a draw event when wanting to set the projection, change zfrom and zto to z2 and z2. I will show you an example of how to put it to use by showing you how to make a stair. Add a step event, and in it, code:

{  if (distance_to_object(obj_stair) < 1) {      z1 += 1; z2 += 1; if (z2 > 12) {      z1 = 2; z2 = 12; };  };   else {     z1 -= 1; z2 -= 1; if (z1 < 0) {       z = 0; };   }; }

z1 and z2 are plused and minused by 1 to avoid sudden unrealistic jumps from z values.