I want to set a mask on a Sprite/AtlasSprite Object, so that it just appears in a defined area. I remember UIImage has a function called :setMask. Does there any way that Sprite/AtlasSprite object can do the similar thing?
Thanks!
A fast, easy to use, free, and community supported 2D game engine
I want to set a mask on a Sprite/AtlasSprite Object, so that it just appears in a defined area. I remember UIImage has a function called :setMask. Does there any way that Sprite/AtlasSprite object can do the similar thing?
Thanks!
That's a good question, im pretty sure that's not possible - although i'm curious to see what work around solutions people have come up with.
glScissor does something like this, and i've seen some other samples about this to...
http://www.cocos2d-iphone.org/forum/topic/996#post-5974
http://www.cocos2d-iphone.org/forum/topic/1708#post-11843
and here's an action that masks something, using setTextureRect:
http://www.cocos2d-iphone.org/forum/topic/1306#post-7891
Hope it helps!
The above referece shows how to mask an object in a rectanglar area. But my case is trying to clip an image in a circular area. So there are no easy ways to do it, right?
Does anyone have a definitive answer on this? The docs / forum posts are either out of date / non-existent / confusing.
If I want to have a portion of a large image only displaying through the alpha channel of a sprite which was been created from a png with transparency (e.g. a black jigsaw piece on a transparent background), is this possible using the existing sprite class in 0.99 final?
in layers:
layer 1 - background image
layer 2 - sprite created from a png with transparency (jigsaw piece)
layer 3 - the user sees only the portion of the background image visible through the jigsaw piece
Are you guys just talking about defining your CGRect?
Bump. I am also looking for a solution to something similar to @codecowboy
You must log in to post.