GameMaker Depth issue

D

Dave Holland Art

Guest
I have an isometric/top down (zelda style) game I'm working on. I have (currently) 2 rooms. I'm using
depth = -y;
to control the depth of my characters. If I leave room1 to go to room2, it works fine. If I return to room1, it doesn't work anymore. Any ideas?
 
D

Deanaro

Guest
try at "room start" event to run depth = -y;
also I suggest using depth = -bbox_bottom;
this should work better if sprites have different sizes
 
D

Dave Holland Art

Guest
try at "room start" event to run depth = -y;
also I suggest using depth = -bbox_bottom;
this should work better if sprites have different sizes
Neither of those produced any new result. It's so strange because it only does it when I go back to room_1.
 
D

Deanaro

Guest
thats weird.
is the depth =-y; inside an if statement or something? also are there any other places that the depth is being changed?
maybe try using the debugger to see whats going on.
 
D

Dave Holland Art

Guest
thats weird.
is the depth =-y; inside an if statement or something? also are there any other places that the depth is being changed?
maybe try using the debugger to see whats going on.
depth =-y; is being used on a parent object that is persistent. It is happening in a step event and inside no other statement.
The children are the player object and the enemy object. There are wall objects, too, but they are not children. Again, everything is FINE in room_1 and room_2 UNTIL I go back to room_1; What's even MORE odd is that room_2 works just fine no matter what.
 
D

Deanaro

Guest
try placing the code in the actual objects and see if this problem still persists.

EDIT:
I think you need to use:
event_inherited();
in your step event to make sure the parent event is being ran.
 
D

Dave Holland Art

Guest
try placing the code in the actual objects and see if this problem still persists.

EDIT:
I think you need to use:
event_inherited();
in your step event to make sure the parent event is being ran.
Already have that. No fixy.
 
D

Dave Holland Art

Guest
Is it possible that the depth settings from room_2 are affecting room_1?
 
D

Deanaro

Guest
first of all check for any differences in room_1 and room_2, like is there a control object, are they persistant, creation code ect and determine if those differences could be causing the problem, because as you said room_2 works fine.

If you dont succeed then you should use the debugger now.
recreate the bug then place a breakpoint in the debugger anywhere the depth is changed.
if the game doesnt pause after you placed breakpoints then you know that the line isnt being executed.
you can also view the instance's depth value.
 
D

Dave Holland Art

Guest
I found that if I make both rooms persistent, it fixes it.
 
Top