Tile depth on create

ph101

Member
Hi

In an isometric game, I'm swapping an object at a certain position and depth for a tile at the same depth to save on draw time.

Code:
proxy_tile = tile_add(FloorTiles1, tile_x_start, 0, tile_x_start + sizex, sizy, xx, yy, depth);
visible = 0;
Then I am setting my object to be invisible but still available for collision detection.

This all works spiffingly, except that for a fleeting instant, maybe a step, I can see the new tile being drawn in front of objects that it should be behind. Is it possible that a new tile when created as above is first drawn after other objects due to sequence of the draw pipeline, before being sorted at correct depth? Or is there some other issue with my code at work.

Thanks in advance.
 
Last edited:

Hyomoto

Member
This may sound funny but you do have control of the draw routine. So -technically- if you are encountering this problem you could implement a sort of frame skip and not refresh the screen for that moment. Honestly without the larger context this one is hard for me to say, as personally I haven't dealt much with tiles. I've been playing with this a lot recently but you could, for example, set your room speed to 120 and only draw it every other frame. If you put this tile processing in the previous frame, the bug shouldn't occur because all the related processing will happen during that frame, and be drawn the next.

That's obviously a far more complicated solution for an issue that may not require it. Based on the code you are showing, however, is it possible that you are setting the depth of something somewhere you don't expect and that's causing it? For example, the draw event?
 

ph101

Member
Thanks for your thoughts. Ok It look l ike it was what you suggested. I was calling this in the draw event. I guess for whatever reason that was messing with the draw order of the new tile. Put the code in step and it seems to work fine. Thanks again!
 
Y

Yacob

Guest
Thanks for your thoughts. Ok It look l ike it was what you suggested. I was calling this in the draw event. I guess for whatever reason that was messing with the draw order of the new tile. Put the code in step and it seems to work fine. Thanks again!
Don't use draw for anything but draw functions. I learned this the hard way. lol
 
Top