slycrel/JSTileMap

Remove a tile from multiple layer show the background

Closed this issue · 2 comments

Hi,

I've buid a map with three different tile layers. Background, Foreground and Metadata.Running the project on debug I've this:

Background has zPosition -80.000000
Foreground has zPosition -40.000000
Layer Metadata has zPosition -20.000000

After that I've set the Metadata layer with :

    // Load the MAP
    _tileMap = [JSTileMap mapNamed:@"trial.tmx"];

    self.foreground = [_tileMap layerNamed:@"Foreground"];

   self.metadata = [_tileMap layerNamed:@"Metadata"];
    // Hide the metadata layer
    _metadata.layerInfo.layer.hidden = TRUE;

So the metadata layer is hidden, in fact we don't see in render. The map is rendered correctly, in fact the background is rendered first than foreground.

Now I've to delete one tile at specific coordinates:

CGPoint tileUnderPlayerPosition = CGPointMake(self.player.position.x + (self.startPosition.x * -1), self.player.position.y + (self.startPosition.y * -1));

CGPoint tileCoord = [self tileCoordForPosition:tileUnderPlayerPosition];
[_metadata removeTileAtCoord:tileCoord];
[_foreground removeTileAtCoord:tileCoord];

The tile under player position is removed on metadata layer than on foreground but i didn't see the background, I see the view background color. Why ?

Thanks

Roberto

Can you get me a sample project going for this? I've been unable to reproduce this.

Hi,
due to this problem i've changed my approach removing the second layer. Before this I've solved the problem changing the layer order into the Tile Editor than swapping zPosition layer via code.