• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Need help for depth controller.

B

begjan

Guest
Guys I am kind of having big problem with Depth controller and seeking your help. If you know how to make it or wanna share some code please help me to solve it. :)
I need depth setters and getters function for my obj_depth_controller that controls obj_player and obj_enemy depth...
 

jo-thijs

Member
This question isn't specific enough.

What do you mean with depth?
Do you mean GameMaker's built-in variable depth?
Do you mean a self defined z-variable?
Do you mean yet something else?

What do you mean with getters and setters?
What should the getters and setters do beyond directly getting and setting the value of some variable?
What exactly should be gotten and what exactly should be set?

How does obj_depth_controller control obj_player and obj_enemy?

Also, is this thread related to one of your previous depth threads?
 
B

begjan

Guest
Well. Getter is like function that get obj_player depth to show in left top corner. like fps or health.
Setter is means when keyboard_check_pressed(ord("D")) then it will set player depth to 1 or keyboard_check_pressed(ord("S")) then depth to -1 something like that.
when player's depth set to example: -5 then other place_meeting function should not work.
example of place_meeting function:
if (obj_player.depth == -3)
{
if place_meeting(x,y,obj_player)
{
scr_collision_code();
}
}

sorry maybe my english is not enough to explain what i really mean. :(
 

jo-thijs

Member
So, you're talking about GameMaker's built-i depth variable?
It actually sounds more like you're using your own z variable.

Anyway, getting and setting the variable is done just the same way as with any other variable.

For having a place_meeting that only checks on instances with the same depth, you could use a script like this:
Code:
///scr_place_meeting_depth(x, y, obj, depth)

with argument2
    if depth == argument3
        with other
            if place_meeting(argument0, argument1, other)
                return true;
return false;
 
B

begjan

Guest
jo-thijs do you have skype or facebook?
i think i need more help about depth. and thank you for your help :)
 
Top