Possible to remove part of sprite that player contacts?


#1

If I have a character that is running through a tilemap, is it possible to only remove (or setvisible(false)) only the portions of the sprite that they come into contact with?

Thanks in advance!

SSL


#2

@shadysidelabs
You can cut a Sprite using CCRectMake with setTextureRect.
More or less:

CCRect newRect = CCRectMake(_mySprite->getTextureRect().origin.x,_mySprite->getTextureRect().origin.y,_newWidth,_mySprite->getContentSize().height);
_mySprite->setTextureRect(newRect,true,_mySprite->getContentSize());
_mySprite->setPosition(ccp(_newWidth/2,_mySprite->getContentSize().height/2));

This cuts the sprite horizontally from right to left