깜박이게 하는 액션기능 (Blink)



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
#include "test122.hpp"
 
USING_NS_CC;
 
Scene* Test122::createScene()
{
    auto scene = Scene::create();
    
    auto layer = Test122::create();
    scene->addChild(layer);
    
    return scene;
}
 
 
bool Test122::init()
{
    if ( !Layer::init())
    {
        return false;
    }
    
    
    auto sprite = Sprite::create("testimage.png");
    sprite->setPosition(Point(100,100));
    this->addChild(sprite);
 
    
    //Blink::create(액션기간, 깜박이는 횟수) : 객체 깜박이게 설정
    auto blinkAction = Blink::create(3.010);  //3초동안 스프라이트 객체를 10번 깜박임
    sprite->runAction(blinkAction);
    
    
    return true;
}
 
cs



결과

3초동안 10번 깜박인다



+ Recent posts