0
當我觸摸精靈時,我想在多個精靈中找到精靈(多邊形)。觸摸並找到精靈
我想下面的代碼,但它不工作。
CCTouchBegan事件:
CCPoint point = this->convertTouchToNodeSpace(ptouch);
CCRect bomb11Rect = CCRectMake(bomb->getPosition().x ,
bomb->getPosition().y ,
bomb->getContentSize().width,
bomb->getContentSize().height);
CCRect posRect = CCRectMake(point.x ,
point.y ,
1,
1);
if (bomb11Rect.intersectsRect(posRect))
{
CCLog("Touch the sprite");
}
else
{
CCLog("Not Touch the sprite");
}
任何人給我的想法來解決上述問題?