Hi! I am trying to remove tile from tilemap (for ring collision) with this code:
Code:
if(ring_found)
{
PlaySoundId(7);
TLN_SetTilemapTile(foreground_tilemap,tileinfo.row,tileinfo.col,TLN_Tile(0));
TLN_SetLayer(LAYER_FOREGROUND,NULL,foreground_tilemap);
rings++;
}
But it gives Invalid Pallete reference when running SetLayer(). Any solution?
Are you using the same assets you posted some days ago?
It's not needed to reconfigure layer with TLN_SetLayer() once you modify the tilemap with TLN_SetTilemapTile(), they're already linked.
Removed SetLayer(), still not removing tile. But no more errors in log.
Are you passing the correct row and column? The following code works for me, when I press input 1, it removes the first ring:
Code:
while (TLN_ProcessWindow()) {
if (TLN_GetInput(INPUT_BUTTON1)) {
Tile tile = {0};
TLN_SetTilemapTile(foreground_tilemap, 54, 6, &tile);
}
TLN_DrawFrame(0);
}
Thanks! You need to define empty tile before setting it and use
Code:
Tile tile={0};
TLN_SetTilemapTile(foreground_tilemap,tileinfo.row,tileinfo.col,&tile);
instead of
Code:
TLN_SetTilemapTile(foreground_tilemap,tileinfo.row,tileinfo.col,NULL);
Welcome!
I understand the confusion, it seems more intuitive to delete a tile passing just NULL instead of a valid pointer with index 0, right? I'll add this behavior in next update