Feel free to fix/add documentation to the wiki
Actions: Composition
결합되는 몇 가지 다음 액션들이 있습니다.
- Sequence action
- Spawn action
- Repeat action
- RepeatForever action
시퀀스
Sequence 액션은 액션의 순서를 만들고 순차적으로 실행됩니다.
예제:
id action1 = [MoveTo actionWithDuration:2 position:ccp(100,100)]; id action2 = [MoveBy actionWithDuration:2 position:ccp(80,80)]; id action3 = [MoveBy actionWithDuration:2 position:ccp(0,80)]; [sprite runAction: [Sequence actions:action1, action2, action3, nil]];
action1 이 가장 먼저 실행되고 action1 이 끝나고 난 후 action2가 실행됩니다. action2 가 끝나면 action3 이 실행되게 됩니다.
*주의:* 내부의 액션들은 무한하여서는 안됩니다.(eg: Sequence액션에 RepeatForever 액션을 추가할 수 없습니다.)
스폰
Spawn 액션은 같은 시간에 여러 액션을 실행하게 해 줍니다. Spawn 액션이 실행되는 기간은 가장 긴 서브액션의 기간입니다.
id action = [Spawn actions: [JumpBy actionWithDuration:2 position:ccp(300,0) height:50 jumps:4], [RotateBy actionWithDuration: 2 angle: 720], nil]; [sprite runAction:action];
반복
Repeat 액션은 정해진 수 만큼 하나의 액션을 반복하게 해 줍니다.
예제:
id a1 = [MoveBy actionWithDuration:1 position:ccp(150,0)]; id action1 = [Repeat actionWithAction: [Sequence actions: [Place actionWithPosition:ccp(60,60)], a1, nil] times:3]; [sprite runAction:action1];
무한반복
RepeatForever 액션은 특별한 액션입니다. 무한하게 실행되기 때문에 이 액션은 측정될 수 없습니다.
Example:
id a1 = [MoveBy actionWithDuration:1 position:ccp(150,0)]; id action2 = [RepeatForever actionWithAction: [Sequence actions: [[a1 copy] autorelease], [a1 reverse], nil] ]; [sprite runAction:action2];
*주의*: RepeatForever는 IntervalAction에 적용될 수 없으며 Sequence액션 내부에 사용할 수 없습니다.
Trace: » actions » hello_events » effects » actions_ease » basic_concepts » hello_actions » hello_events » actions_special » basic_concepts » actions_composition