딜레이타임 주기 (DelayTime)



c++)

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
32
33
34
35
36
37
38
39
#include "test132.hpp"
 
USING_NS_CC;
 
Scene* Test132::createScene()
{
    auto scene = Scene::create();
    
    auto layer = Test132::create();
    scene->addChild(layer);
    
    return scene;
}
 
 
bool Test132::init()
{
    if ( !Layer::init())
    {
        return false;
    }
    
    
    auto sprite = Sprite::create("ball.png");
    sprite->setPosition(Point(100,100));
    this->addChild(sprite);
    
    
    auto action1 = MoveTo::create(2.0, Point(400,100));
    //DelayTime::create(시간) : 아무것도 하지않고 정해진 시간만큼 기다린다
    auto delaytime = DelayTime::create(3.0);
    auto action2 = MoveTo::create(1.0, Point(50,50));
    auto sequenceAction = Sequence::create(action1, delaytime, action2, NULL);
    sprite->runAction(sequenceAction);
        
    
    return true;
}
 
cs



결과

(400,100)으로 이동한후 3초간 기다렸다 (50,50)으로 이동한다



+ Recent posts