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! enter image description here enter image description here enter image description here

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

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -