<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、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                1.今天學習了有關動作的回調的內容。 1)就方法回調進行說明:簡單的說 就是使用了SEL 選擇器方法 ~~~ -(id) init { // always call "super" init // Apple recommends to re-assign "self" with the "super's" return value if( (self=[super init]) ) { //獲取當前屏幕的大小 CGSize size = [CCDirector sharedDirector].winSize; // 創建第一個精靈,并將其添加為當前層的子節點 apple = [CCSprite spriteWithFile:@"apple.png"]; apple.position = ccp(50,100); apple.opacity = 0; [self addChild:apple]; // 創建第二個精靈,并將其添加為當前層的子節點 plane = [CCSprite spriteWithFile:@"plane.png"]; plane.position = ccp(size.width/2,size.height/2); plane.opacity = 0; [self addChild: plane]; // 創建第三個精靈,并將其添加為當前層的子節點 ball = [CCSprite spriteWithFile:@"ball.png"]; ball.position = ccp(250,100); ball.opacity = 0; [self addChild:ball]; // 創建第四個精靈,并將其添加為當前層的子節點 orange = [CCSprite spriteWithFile:@"orange.png"]; orange.position = ccp(250,300); orange.opacity = 0; [self addChild:orange]; // 創建第五個精靈,并將其添加為當前層的子節點 tomato = [CCSprite spriteWithFile:@"tomato.png"]; tomato.position = ccp(250,200); tomato.opacity = 0; [self addChild:tomato]; // 第一個精靈執行序列組合動作,其中最后一個動作調用了moveSprite方法 [apple runAction:[CCSequence actions:[CCDelayTime actionWithDuration:1], [CCSpawn actions: [CCFadeIn actionWithDuration:1], [CCScaleTo actionWithDuration:1 scale:1.5], nil], [CCDelayTime actionWithDuration:1], [CCCallFunc actionWithTarget:self selector:@selector(moveSprite)], nil]]; // 第二個精靈執行序列組合動作,其中最后一個動作調用了removeSprite:方法,并將當前的節點對象傳遞給指定的方法,注意冒號不能省略 [plane runAction:[CCSequence actions:[CCDelayTime actionWithDuration:1], [CCSpawn actions: [CCFadeIn actionWithDuration:1], [CCScaleTo actionWithDuration:1 scale:1.5], nil], [CCDelayTime actionWithDuration:1], [CCCallFuncN actionWithTarget:self selector:@selector(removeSprite:)], nil]]; // 第三個精靈執行序列組合動作,其中最后一個動作調用了tintSprite:data:方法,并將當前的節點對象和數據傳遞給指定的方法,注意冒號和參數不能省略 [ball runAction:[CCSequence actions:[CCDelayTime actionWithDuration:1], [CCSpawn actions: [CCFadeIn actionWithDuration:1], [CCScaleTo actionWithDuration:1 scale:1.5], nil], [CCDelayTime actionWithDuration:1], [CCCallFuncND actionWithTarget:self selector:@selector(tintSprite:data:)data:(void *)2], nil]]; // 第四個精靈執行序列組合動作,其中最后一個動作調用了tintSprite:data:方法,并將當前的節點對象和數據傳遞給指定的方法,注意冒號和參數不能省略 [orange runAction:[CCSequence actions:[CCDelayTime actionWithDuration:1], [CCSpawn actions: [CCFadeIn actionWithDuration:1], [CCScaleTo actionWithDuration:1 scale:1.5], nil], [CCDelayTime actionWithDuration:1], [CCCallFuncO actionWithTarget:self selector:@selector(rotateSprite:object:) object:tomato], nil]]; } return self; } ~~~ 2.塊語句回調:一句話就是在代碼中嵌入了 block語句 ~~~ -(id) init { // always call "super" init // Apple recommends to re-assign "self" with the "super's" return value if( (self=[super init]) ) { // ask director for the window size CGSize size = [[CCDirector sharedDirector] winSize]; // 創建第一個精靈,并將其添加為當前層的子節點 apple = [CCSprite spriteWithFile:@"apple.png"]; apple.position = ccp(50,100); apple.opacity = 0; [self addChild:apple]; // 創建第二個精靈,并將其添加為當前層的子節點 plane = [CCSprite spriteWithFile:@"plane.png"]; plane.position = ccp(size.width/2,size.height/2); plane.opacity = 0; [self addChild: plane]; // 創建第三個精靈,并將其添加為當前層的子節點 ball = [CCSprite spriteWithFile:@"ball.png"]; ball.position = ccp(250,100); ball.opacity = 0; [self addChild:ball]; // 創建第四個精靈,并將其添加為當前層的子節點 orange = [CCSprite spriteWithFile:@"orange.png"]; orange.position = ccp(250,300); orange.opacity = 0; [self addChild:orange]; [apple runAction:[CCSequence actions:[CCDelayTime actionWithDuration:1], [CCSpawn actions: [CCFadeIn actionWithDuration:1], [CCScaleTo actionWithDuration:1 scale:1.5], nil], [CCDelayTime actionWithDuration:1], [CCCallBlock actionWithBlock:^{ [apple runAction:[CCMoveTo actionWithDuration:2 position:ccp(50, 200)]]; }], nil]]; [plane runAction:[CCSequence actions:[CCDelayTime actionWithDuration:1], [CCSpawn actions: [CCFadeIn actionWithDuration:1], [CCScaleTo actionWithDuration:1 scale:1.5], nil], [CCDelayTime actionWithDuration:1], [CCCallBlockN actionWithBlock:^(CCNode *node){ CCNode *currentNode = node; [self removeChild:currentNode cleanup:YES]; }], nil]]; [ball runAction:[CCSequence actions:[CCDelayTime actionWithDuration:1], [CCSpawn actions: [CCFadeIn actionWithDuration:1], [CCScaleTo actionWithDuration:1 scale:1.5], nil], [CCDelayTime actionWithDuration:1], [CCCallBlockO actionWithBlock:^(id object){ CCNode *currentNode = (CCNode *)object; [currentNode runAction:[CCSequence actions:[CCFadeIn actionWithDuration:2],[CCRotateBy actionWithDuration:3 angle:180], nil]]; } object:orange], nil]]; } return self; } ~~~ 3.反轉動作:如果一系列動作有順序,那么反轉動作就是原來動作的逆向run 與 CCReverseTime 有關 4.特殊動作 CCActionTween ?主要是修改一個對象的屬性,比如說 ?scale,width等 id scaleA = 【CCScale actionWithDuration :2 scale:3】; id scaleB = 【CCActionTween actionWithDuration:2 key: @“Scale” form 1:to:3】; CCSpeed 可以修改一個飛機的速度。
                  <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>

                              哎呀哎呀视频在线观看