onEnterTransitionDidFinish()的用途
void BackgroundMove::onEnterTransitionDidFinish()//进入之后自动滑动,所以在调用时直接添加,不用调用方法。 { Layer::onEnterTransitionDidFinish(); this->schedule(SEL_SCHEDULE(&BackgroundMove::move), 0.01f); } void BackgroundMove::move(float dt) { Vec2 origin = Director::getInstance()->getVisibleOrigin(); m_background1->setPositionY(m_background1->getPositionY() - OFFSET); m_background2->setPositionY(m_background1->getPositionY() + m_background1->getContentSize().height); if (m_background2->getPositionY() <= origin.y) m_background1->setPositionY(0); m_background3->setPositionY(m_background3->getPositionY() + OFFSET); m_background4->setPositionY(m_background3->getPositionY() - m_background3->getContentSize().height); if (m_background4->getPositionY() >= origin.y) m_background3->setPositionY(0); }