Android 用の cocos2d-x でゲームを開発していますが、問題が発生しました。
_hammer = CCSprite::createWithSpriteFrameName("Hammer.png");
_hammer->setPosition(ccp(_screenSize.width * 0.5f - 4*((_hammer->getContentSize().width) * 0.15f), _screenSize.height * 0.055f ));
_hammer->setVisible(true);
_hammer->setScale((_screenSize.width / _hammer->getContentSize().width) * 0.15f);
_hammer->setScale((_screenSize.height / _hammer->getContentSize().height) * 0.15f);
_hammerSelected = true;
{
CCTouch *touch = (CCTouch *) pTouches->anyObject();
CCPoint location = touch->locationInView();
location = CCDirector::sharedDirector()->convertToGL(location);
if ((CCRect::CCRectContainsPoint(_hammer->boundingBox(), location))) {
//do something
}
CC_SPRITE_DEBUG_DRAW と CC_SPRITEBATCHNODE_DEBUG_DRAW をオンにしましたが、問題は、boundingBox が見た目よりも大きいことです。境界ボックスの近くのどこかをクリックすると、実際に内部をクリックしたかのように登録されます。
誰でも私を助けることができますか?:)