<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                采用雙層背景,這樣效果更好 .h ~~~ class BackgroundMove : public Layer { public: BackgroundMove(); ~BackgroundMove(); virtual bool init(); virtual void onEnterTransitionDidFinish(); //等進入場景之后在進行背景的移動 CREATE_FUNC(BackgroundMove); public: void move(float dt); private: Sprite* m_background1; Sprite* m_background2; Sprite* m_background3; Sprite* m_background4; enum { OFFSET = 3 }; }; ~~~ 背景無限滾動的方式有很多,只要不出現黑邊即可 .cpp ~~~ BackgroundMove::BackgroundMove() : m_background1(NULL), m_background2(NULL), m_background3(NULL), m_background4(NULL) { } BackgroundMove::~BackgroundMove() { CC_SAFE_DELETE(m_background1); CC_SAFE_DELETE(m_background2); CC_SAFE_DELETE(m_background3); CC_SAFE_DELETE(m_background4); } bool BackgroundMove::init() { bool bRect = false; do { if (!Layer::init()) return false; //加載背景圖片 m_background1 = Sprite::createWithSpriteFrameName("backgroundTollgate2.png"); m_background1->setPosition(Point(0,0)); m_background1->setAnchorPoint(Vec2(0, 0)); this->addChild(m_background1,1); m_background2 = Sprite::createWithSpriteFrameName("backgroundTollgate2.png"); m_background2->setPosition(Point(0, 0)); m_background2->setAnchorPoint(Vec2(0, 0)); m_background2->setFlipY(true); this->addChild(m_background2,1); //加載背景圖片 m_background3 = Sprite::createWithSpriteFrameName("backgroundTollgateThree.png"); m_background3->setPosition(Point(0, 0)); m_background3->setAnchorPoint(Vec2(0, 0)); this->addChild(m_background3, 0); m_background4 = Sprite::createWithSpriteFrameName("backgroundTollgateThree.png"); m_background4->setPosition(Point(0, 0)); m_background4->setAnchorPoint(Vec2(0, 0)); m_background4->setFlipY(true); this->addChild(m_background4, 0); CocosDenshion::SimpleAudioEngine::getInstance()->playBackgroundMusic("sound/BackgroundMusic.mp3", true); bRect = true; } while (0); return bRect; } 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); } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看