cocos2d 怎么实现两个动作执行完之后执行第三个

CCAction* ac1 = ...
CCAction* ac2 = ...
CCAction* ac3 = ..
现在的需求时ac1和ac2同时执行,都执行完之后执行ac3怎么搞```?
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
如果您想在Cocos2d中绘制两个节点,您可以按照以下步骤操作: 1. 创建两个节点对象 ```cpp auto node1 = Node::create(); auto node2 = Node::create(); ``` 2. 分别将这两个节点添加到场景中 ```cpp this->addChild(node1); this->addChild(node2); ``` 3. 对每个节点设置位置、颜色、大小等属性 ```cpp node1->setPosition(Vec2(100, 100)); node1->setColor(Color3B::RED); node1->setScale(2.0f); node2->setPosition(Vec2(200, 200)); node2->setColor(Color3B::BLUE); node2->setScale(1.5f); ``` 4. 在每个节点中添加需要绘制的内容,例如精灵、标签等 ```cpp auto sprite1 = Sprite::create("sprite1.png"); node1->addChild(sprite1); auto label1 = Label::createWithTTF("Node 1", "fonts/arial.ttf", 24); node1->addChild(label1); auto sprite2 = Sprite::create("sprite2.png"); node2->addChild(sprite2); auto label2 = Label::createWithTTF("Node 2", "fonts/arial.ttf", 24); node2->addChild(label2); ``` 5. 运行程序,即可看到两个节点的内容被绘制在屏幕上 ```cpp bool MyScene::init() { if (!Scene::init()) { return false; } auto node1 = Node::create(); auto node2 = Node::create(); this->addChild(node1); this->addChild(node2); node1->setPosition(Vec2(100, 100)); node1->setColor(Color3B::RED); node1->setScale(2.0f); node2->setPosition(Vec2(200, 200)); node2->setColor(Color3B::BLUE); node2->setScale(1.5f); auto sprite1 = Sprite::create("sprite1.png"); node1->addChild(sprite1); auto label1 = Label::createWithTTF("Node 1", "fonts/arial.ttf", 24); node1->addChild(label1); auto sprite2 = Sprite::create("sprite2.png"); node2->addChild(sprite2); auto label2 = Label::createWithTTF("Node 2", "fonts/arial.ttf", 24); node2->addChild(label2); return true; } void MyScene::onEnter() { Scene::onEnter(); } ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值