본문 바로가기

카테고리 없음

[cocos2d-x]응용액션 (스폰액션)

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "HelloWorldScene.h"
 
Scene* HelloWorld::createScene()
{
    auto scene = Scene::create();
 
    auto layer = HelloWorld::create();
    scene->addChild(layer);
 
    return scene;
}
 
bool HelloWorld::init()
{
    if (!Layer::init())
    {
        return false;
    }
 
    auto spr = Sprite::create("ball.png");
    spr->setPosition(Point(100100));
    this->addChild(spr);
 
    auto action_0 = MoveTo::create(2.0, Point(400100));
    auto action_1 = FadeOut::create(2.0);
    auto action_2 = ScaleTo::create(2.03.0);
    auto action_3 = Spawn::create(action_0, action_1, action_2, NULL);
    spr->runAction(action_3);
 
    return true;
}
cs

 


시퀀스 액션이랑 비슷하나 다른액션과 동시에 쓴다는게 다름

이것도 여러 방식으로 많이 쓰일 것 같습니다.