除去3花哨的效果我有子類Layer
和overrided onEnter
功能是這樣的:的cocos2d-x的階段
void MyLayer::onEnter()
{
Layer::onEnter();
Size visibleSize = Director::getInstance()->getVisibleSize();
Point visibleOrigin = Director::getInstance()->getVisibleOrigin();
setPosition(visibleOrigin.x, visibleOrigin.y + visibleSize.height);
runAction(EaseOut::create(MoveTo::create(1, Vec2(visibleOrigin)), 10));
}
這導致我的層從頂部和輕鬆進入效果在屏幕上。現在我想從氣味中去除同一種效果的圖層。我曾嘗試使用onExitTransitionDidStart
,但它並不能幫助:
void MyLayer::onExitTransitionDidStart()
{
Size visibleSize = Director::getInstance()->getVisibleSize();
Point visibleOrigin = Director::getInstance()->getVisibleOrigin();
runAction(EaseIn::create(MoveTo::create(1, Vec2(visibleOrigin.x, visibleOrigin.y + visibleSize.height)), 10));
}
我如何控制層正在從舞臺上刪除的方式嗎?
你想在現場取代或只是想從場景中刪除圖層? –
@VikasPatidar我想在圖層上運行一個動作,然後將其從父級的子級列表中移除(從屏幕上移除)。 – Narek