Trying to make a global z axis

Pkirkby

Member
Hey everone, using this video
I was able to get a zaxis implemented, although I don't fully understand it. Is anyone able to explain to me which part of this sets the z axis. I'm trying to make a script or a parent object that sets a z axis for all objects that may be floating or jumping. And then in the object itself, change (z = 12) for example, and have it come off the ground.

Hopefully I explained it well, thanks for your time.
 

TheouAegis

Member
z = 0;
floorz = 0;

The floorz is the "deadzone" for that instance's z-axis. z is the current position on the z-axis. You don't really need floorz at all, since that would usually be dictated by the tile at (x,y).

To make everyone float, just do

with all z++
 

Pkirkby

Member
z = 0;
floorz = 0;

The floorz is the "deadzone" for that instance's z-axis. z is the current position on the z-axis. You don't really need floorz at all, since that would usually be dictated by the tile at (x,y).

To make everyone float, just do

with all z++
So, since I've got a lot to learn still, can you expand on that a bit for me? I understand the with statement, but how would I go about creating some sort of script or object that sets the z-axis in the first place? I hate asking for code without fully understanding it, but in this case seeing it (even if its a rough example of code) may help. Appreciate your time!
 

TheouAegis

Member
There is no z axis; all you are doing is using a variable (z) which you then subtract from the y-coordinate in a draw_sprite_ext() call in the Draw Event of every object. The z axis is imaginary.

draw_sprite_ext(sprite_index,-1,x,y-z,image_xscale,image_yscale,image_angle,image_blend,image_alpha);
 

Pkirkby

Member
There is no z axis; all you are doing is using a variable (z) which you then subtract from the y-coordinate in a draw_sprite_ext() call in the Draw Event of every object. The z axis is imaginary.

draw_sprite_ext(sprite_index,-1,x,y-z,image_xscale,image_yscale,image_angle,image_blend,image_alpha);
Ok, I kind of get that now. What did you mean with the Z++?
 
Top