I am new to COCOS2d. I am using ccsprite with animation as a button. Now i am struggle to detect the CCTouches and CCsprite getbounding box are equals for click event.
Asked
Active
Viewed 274 times
-1
-
Can You please elaborate what exactly are you trying to do. The question seem quite vague – Ganesh Somani Jul 31 '13 at 06:51
-
I am using Menuitem with ccsprite. But i need Menuitem with animating spite. – Bebin T.N Jul 31 '13 at 08:19
-
you want to detect or need menuitem with animating sprite .. – Akarsh M Jul 31 '13 at 09:07
1 Answers
1
From this way you can achieve what you need and write this code in CCtouches___() :
ArrayList<CCSprite> animation= new ArrayList<CCSprite>();
CGPoint location = CCDirector.sharedDirector().convertToGL(CGPoint.ccp(event.getX(), event.getY()));
for (CCSprite target : animation){
if(CGRect.containsPoint((target.getBoundingBox()), location)){
//here what you want
}

Akarsh M
- 1,629
- 2
- 24
- 47