Hello everybody. I have trouble updating depth of my object in isometric game: when the object takes the neccesary tile the depth works right but while moving the depth is always changing and the cube is dissapearing every step, "hiding" behind the house object. Here is the code of my step event (both of house and cube):
I have tryed moving depth changing code to the beginning but it doesn't help. So I hope somebody else who is more familiar with it all can help. PLease(
Maybe the problem is just that sprites don't fit the tile size, but still I am not sure wheter my code is right.
GML:
if(V!=0)
{
currentTile[TILE.tX]=ScreenTo_tX(x,y);
currentTile[TILE.tY]=ScreenTo_tY(x,y);
}
currentTile[TILE.tX]=clamp(currentTile[TILE.tX],0,MAP_W);
currentTile[TILE.tY]=clamp(currentTile[TILE.tY],0,MAP_H);
currentTile=global.theMap[# currentTile[TILE.tX],currentTile[TILE.tY]];
if(is_array(currentTile)) z=currentTile[TILE.Z];
depth=0-(currentTile[TILE.tX]+currentTile[TILE.tY]+z);
Maybe the problem is just that sprites don't fit the tile size, but still I am not sure wheter my code is right.
Attachments
-
87.8 KB Views: 21
-
87.8 KB Views: 21
-
87.9 KB Views: 17