ios - Cocos2d image masking -
i'm working on game main character rides on ship , when enemy parallel ship, drops tube. main problem tube bigger ship visible behind while going down or up. please note image (the ship) on top of tube transparent image. thanks!
you can clip draw regions in cocos2d without effort. if add code tube object can define suitable region draw object. outside of rectangle doesn't drawn.
-(void) visit { if(!self.visible) return; glenable(gl_scissor_test); cgrect thisclipregion = _clipregion; thisclipregion = cc_rect_points_to_pixels(thisclipregion); glscissor(thisclipregion.origin.x, thisclipregion.origin.y, thisclipregion.size.width, thisclipregion.size.height); [super visit]; gldisable(gl_scissor_test); }
Comments
Post a Comment