S
Smallmak
Guest
Why is my depth sorter working for some object and not for other object? for example the below code makes it so my character appears in front of and behind npcs but Is not working for trees. I have made sure that the tree is a child of parent_depth object
Code:
//Resizegrid
var inst_num = instance_number(par_depthobj);
var dgrid = ds_depthgrid;
ds_grid_resize(dgrid, 2, inst_num);
//add instances to the grid
var yy = 0; with(par_depthobj) {
dgrid[# 0, yy] = id;
dgrid[# 1, yy] = y;
yy += 1;
};
//sort the grid in ascending order
ds_grid_sort(dgrid, 1, true);
//loop through grid and draw instances in order that has been set
var inst; yy = 0; repeat(inst_num) {
//pull out an ID
inst = dgrid[# 0, yy]
//draw yourself
with(inst){
event_perform(ev_draw, 0)
};
yy += 1
};
Attachments
-
145.6 KB Views: 7