zoukankan      html  css  js  c++  java
  • IOS cocos2d笔记1

    结点添加、删除、获取
    1.结点:CCNode * childNode = [CCNode node];

    2.加入结点
    [myNode addChild:childNode z:0 tag:123];//z决定绘制的顺序

    3.获取结点
    CCNode * retrieveNoded = [myNode getChildeByTag:123];

    4.删除 cleanup:YES正在运行的动作停止
    [myNode removeChildByTag:123 cleanup:YES];
    [myNode removeChild:retrievedNode];
    [myNode removeAllChildrenWithCleanup:YES];
    [myNode removeFromParentAndCleanup:YES];

    动作处理
    CCAction * action = [CCBlink actionWithDuration:10 blinks:20];
    action.tag = 234;
    1.运行
    [myNode runAction:action];
    2.获得
    getActionByTag
    3.停止
    stopActionByTag:
    stopAction:
    [myNode stopAllActions]

    消息调度
    [self scheduleUpdate];
    -(void) update:(ccTime)delta
    {}

    [self schedule:@selector(xxx:) interval:0.1f];
    [self scheculeOnce:@selector(xxx:) delay:600];
    //取消计时
    [self unscheduleAllSelectors];
    [self unscheduleUpdate];
    [self unschedule:@selector(xxx:)];
    [self unschedule:_cmd];//_cmd相当于@selector(本身)
    float nextUpdate = CCRANDOM_0_1()*10;
    //附加,了解即可
    [self scheduleUpdateWithPriority:1];//-1,越小优先调用

    Director类(类似ScreenMgr类)
    1.获取
    [Director sharedDirector];
    2.场景运行
    runWithScene、replaceScene、pushScene
    3.场景添加进CCTransitionScene;

  • 相关阅读:
    结对编程收获
    《程序员修炼之道》读书笔记
    《梦断代码》读书笔记
    《编程珠玑》和《梦断代码》(部分) 读书笔记
    团队项目个人心得
    团队项目Alpha阶段心得感悟
    第9周读书笔记
    第8周读书笔记
    结对编程收获
    第七周读书笔记
  • 原文地址:https://www.cnblogs.com/hewei2012/p/3217779.html
Copyright © 2011-2022 走看看