我的思路是做成按钮设置tag 然后在回调函数里执行移除
for(int i=0;i<2;i++){
CCMenuItemImage* room = CCMenuItemImage::create(“stone.png”,
“stone.png”, this, menu_selector(ClimblingGameScene::enterRoom));
room->setPosition(ccp(100* i, 200));
room->setTag(100+i);
CCMenu* selectRoom = CCMenu::create(room, NULL);
selectRoom->setPosition(CCPointZero);
//selectRoom->setTag(100+i);
bg->addChild(selectRoom);
}
回调函数:
enterRoom(CCObject* pSender){
bg->removeChildByTag((CCMenuItemImage*)pSender->getTag());
}
但是pSender好像无法转换,ccobject没有成员getTag();