Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sprite Kit equivalent of clipsToBounds:

I would like to add moving child nodes on a Sprite node, but want them to be clipped if they move outside the bounds, hence giving an impression of a 'window'. I know there is a UIView property called clipsToBounds that does the same. Is there a similar property for SKSpriteNode, and if not, how to achieve the same?

like image 662
ZeMoon Avatar asked Jan 10 '14 13:01

ZeMoon


1 Answers

You could add the sprite supposed to be clipped to a SKCropNode. Then set the crop node's maskNode to a sprite node using an image that defines the crop region.

like image 117
LearnCocos2D Avatar answered Sep 22 '22 07:09

LearnCocos2D