ios - how to move multiple sprite in cocos2d? -



ios - how to move multiple sprite in cocos2d? -

i want move 1 sprite @ moment...but when move sprite method position of other sprite..which not touch position interchange automatic...i have 4 sprite in spriteiconarray , samenumber position in pointarray. please help me.

cclog(@"%.f,%.f",touchlocation.x,touchlocation.y); int k=0; (ccsprite *sprite in spriteiconarray) { if (cgrectcontainspoint(sprite.boundingbox, touchlocation)) { if (k==0) { sprite.position=touchlocation; sprite.zorder=int_max; k++; } else { sprite.position=cgpointfromstring([pointarray objectatindex:sprite.tag]); } } }

in.h define nsinteger spritetag

-(bool) cctouchbegan:(uitouch *)touch withevent:(uievent *)event {

for (ccsprite *sprite in spriteiconarray) { if (cgrectcontainspoint(sprite.boundingbox, touchlocation)) { spritetag=sprite.tag; originalpoint=sprite.position; } }

}

-(void)cctouchmoved:(uitouch *)touch withevent:(uievent *)event

{

for (ccsprite *sprite in spriteiconarray) { if (sprite.tag==spritetag) { sprite.position=touchlocation; sprite.zorder=int_max; } }

}

ios cocos2d-iphone

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -