Quantcast
Channel: cocos2d-x - Cocos Forums
Viewing all articles
Browse latest Browse all 2748

How I remove a tile from layer

$
0
0

@itsabhiaryan wrote:

I have created .tmx file and rendered on screen. Layer having a particular tile that I want to remove from layer.

int i, j is cell row and column and 407 is id of Tile that I want to remove.

auto sprite = layer->getTileAt(Vec2(i, j));
if (sprite && layer->getTileGIDAt(Vec2(i, j)) == 407) { 
      sprite->removeFromParent();
}

It works on Window with Visual Studio, When I tried on Xcode then it give me

Assert failed: removeQuadAtIndex: Invalid index
Assertion failed: (index>=0 && index<_totalQuads), function removeQuadAtIndex, file /TechStuff/Cocos2d-x/MyCocos2d-x/cocos2d-x/cocos/renderer/CCTextureAtlas.cpp, line 414.

and app crashed.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 2748

Latest Images

Trending Articles



Latest Images