In Order to make the sprite(canon) touch and react(firing bullet) to that touch in cocos2d-android, i have set this.setIsTouchEnabled(true);
in constructor, and in ccToouchesBegan() added the below code
@Override
public boolean ccTouchesBegan(MotionEvent event)
{
canon1 = CCSprite.sprite("android.png");
canon1.setPosition(CGPoint.ccp(10, 60));
canon1.setScale(1f);
addChild(canon1);
CGRect canon1Rect = CGRect.make(canon1.getPosition().x - (canon1.getContentSize().width/2),
canon1.getPosition().y - (canon1.getContentSize().height/2),
canon1.getContentSize().width,
canon1.getContentSize().height);
// Choose one of the touches to work with
CGPoint location = CCDirector.sharedDirector().convertToGL(CGPoint.ccp(10,60));
return;
}
so when touched on sprite(cannon) bullets must fire out, but here the touch is not working.