-1

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.

Bebin T.N
  • 2,539
  • 1
  • 24
  • 28

1 Answers1

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