위치 변경하는 액셔기능 (Place)

Place : 액션들을 순차적으로 조합하는 과정에서 중간에 위치를 변경하고 싶을때



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
#include "test114.hpp"
 
USING_NS_CC;
 
Scene* Test114::createScene()
{
    auto scene = Scene::create();
    
    auto layer = Test114::create();
    scene->addChild(layer);
    
    return scene;
}
 
 
bool Test114::init()
{
    if ( !Layer::init())
    {
        return false;
    }
    
    
    auto sprite = Sprite::create("ball.png");   //스프라이트 이미지 객체 생성
    sprite->setPosition(Point(100,100));    //스프라이트 위치 지정
    this->addChild(sprite); //레이어에 추가
    
    
    //Place : 액션들을 순차적으로 조합하는 과정에서 중간에 위치를 변경하고 싶을때
    //Place::create(위치지정)
    auto action = Place::create(Point(200,200));
    sprite->runAction(action);  //액션추가
    
    
    return true;
}
 
cs




+ Recent posts