Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sprite priority?
#2
Yes, layer vs. sprite priority is available but it's a bit undeveloped. Priority is implemented per individual tile and not per full layer: in any given tilemap, you can have some (or all tiles) show in front of sprites. This is accomplished by setting the FLAG_PRIORITY flag in the Tile structure for the desired tiles(s), and the functions TLN_GetTileMapTile() and TLN_SetTilemapTile(). If you want to enable priority on the full tilemap, you could use this helper function:


Code:
void SetTilemapPriority (TLN_Tilemap tilemap)
{
    const int num_rows = TLN_GetTilemapRows (tilemap);
    const int num_cols = TLN_GetTilemapCols (tilemap);
    int row, col;
    
    for (row=0; row<num_rows; row++)
    {
        for (col=0; col<num_cols; col++)
        {
            Tile tile;
            TLN_GetTilemapTile (tilemap, row, col, &tile);
            tile.flags |= FLAG_PRIORITY;
            TLN_SetTilemapTile (tilemap, row, col, &tile);
        }
    }
}

I'll add a property for Tiled editor loader where you will be able to set tile priority right there.
Reply


Messages In This Thread
Sprite priority? - by plot_hole - 08-29-2017, 07:59 AM
RE: Sprite priority? - by megamarc - 08-29-2017, 08:29 PM
RE: Sprite priority? - by plot_hole - 08-31-2017, 08:54 AM
RE: Sprite priority? - by megamarc - 08-31-2017, 05:02 PM
RE: Sprite priority? - by plot_hole - 09-02-2017, 03:23 AM
RE: Sprite priority? - by Domarius - 09-02-2017, 08:20 AM
RE: Sprite priority? - by megamarc - 09-02-2017, 11:58 PM
RE: Sprite priority? - by Domarius - 09-03-2017, 10:42 AM
RE: Sprite priority? - by megamarc - 09-03-2017, 07:08 PM
RE: Sprite priority? - by Domarius - 09-03-2017, 09:23 PM

Forum Jump:


Users browsing this thread: 5 Guest(s)