For those who don't want to fool with figuring out zorder by position, try this code to set it on launch by position. In other words, object near the top are farther away and farther down in the order. objects in front of your player appear over your player. This works with view parented to your player, or using the smooth scrolling method mak describes in this area. For static actors, like trees, rocks, etc., place the call to global code in the actor create call. For mobile actor (player) place call in draw actor.
Global code:
- Code: Select all
void stackit(){
ChangeZDepth("Event Actor", ((y/240)+1)*.5);
}
The 240 is actually half the window size, so adjust this for your window.
player->Draw Actor script:
- Code: Select all
stackit();
tree->Create Actor script:
- Code: Select all
stackit();
Everyone may already know this and be using it, but I haven't seen it posted anywhere and may not be the right way to do it, but it works for me and I thought maybe someone else might find it useful.
