Quote:
Originally Posted by shahidpucit
i have added two sprite in my cocos2d project. then i want to moved them separately. how i know which sprite the user selected. there is any method
Thanks in advance for your help
|
If you add the sprites with a tag, you can then refer to the sprites by their respective tag number.
Like This:
Code:
[self addChild: yourSprite z:0 tag:1];
[self addChild: yourSprite z:0 tag:2];
if ([yourSprite tag] == 1){
yourSprite.position = ccp(x,y);
} else if ([yourSprite tag] == 2) {
yourSprite.position = ccp(x,y);
}
Hope that helps!