J
John Smillie
Guest
Making one of those 3d-looking games like Spineworld or other MMO's you've probably seen. Anyone know how to simulate depth in something like this? Such as, the player sprite is drawn over an object when it is supposed to be in front of it, and is drawn behind it when it should be behind. I tried looking at some tutorials but I can't seem to make it work quite right.
Here is the code for the depth object that's supposed to be placed in the room. I also have an image attached for clarity. The player can go in front of the toilet/stall sprite and the door frame, but he should also be able to do behind them.
create:
draw:
If you need to know anything else, don't hesitate to ask.
Here is the code for the depth object that's supposed to be placed in the room. I also have an image attached for clarity. The player can go in front of the toilet/stall sprite and the door frame, but he should also be able to do behind them.
create:
Code:
ds_depthgrid = ds_grid_create(2,1);
Code:
if(ds_exists(ds_depthgrid,ds_type_grid))
{
var depthGrid = ds_depthgrid;
var instNum = instance_number(obj_par_depth);
ds_grid_resize(depthGrid,2,instNum);
var yy=0;
with(obj_par_depth)
{
depthGrid[# 0,yy]=id;
depthGrid[# 1,yy]=y;
yy++;
}
ds_grid_sort(ds_depthgrid,1,true);
yy=0; repeat(instNum)
{
var instID=ds_depthgrid[# 0,yy];
with(instID)
{
draw_self();
}
yy++;
}
ds_grid_clear(ds_depthgrid,0);
}