Dieses Dokuwiki verwendet ein von Anymorphic Webdesign erstelltes Thema.

Actions: Composition

결합되는 몇 가지 다음 액션들이 있습니다.

  • Sequence action
  • Spawn action
  • Repeat action
  • RepeatForever action

시퀀스 (Sequence)

CCSequence는 액션의 순서를 만들고 순차적으로 실행합니다.

예제:

id action1 = [CCMoveTo actionWithDuration:2 position: ccp(100,100)];
id action2 = [CCMoveBy actionWithDuration:2 position: ccp(80,80)];
id action3 = [CCMoveBy actionWithDuration:2 position: ccp(0,80)];
[sprite runAction: [CCSequence actions: action1, action2, action3, nil]];

action1 이 가장 먼저 실행되고 action1 이 끝나고 난 후 action2가 실행됩니다. action2 가 끝나면 action3 이 실행되게 됩니다.

*주의:* 내부의 액션들은 무한하여서는 안됩니다.(e.g.: CCSequenceCCRepeatForever 을 추가할 수 없습니다.)

스폰 (Spawn)

CCSpawn 은 동시에 여러 액션을 실행하게 해 줍니다. CCSpawn 이 실행되는 기간은 가장 긴 서브액션의 기간입니다.

예제:

id action = [CCSpawn actions:
		[CCJumpBy actionWithDuration:2 position: ccp(300,0) height: 50 jumps: 4],
		[CCRotateBy actionWithDuration: 2 angle: 720],
		nil];
 
[sprite runAction: action];

반복 (Repeat)

CCRepeat 은 정해진 수 만큼 하나의 액션을 반복합니다.

예제:

id a1 = [CCMoveBy actionWithDuration:1 position: ccp(150,0)];
id action1 = [CCRepeat actionWithAction:
		[CCSequence actions: [CCPlace actionWithPosition: ccp(60,60)], a1, nil]
		times: 3];
[sprite runAction: action1];

무한반복 (RepeatForever)

CCRepeatForever 는 특별한 액션입니다. 무한정 실행되기 때문에 이 액션은 측정될 수 없습니다.

예제:

id a1 = [CCMoveBy actionWithDuration: 1 position: ccp (150, 0)];
id action2 = [CCRepeatForever actionWithAction:
		[CCSequence actions: [[a1 copy] autorelease], [a1 reverse], nil]];
[sprite runAction: action2];

*주의*: CCRepeatForeverCCIntervalAction에 적용될 수 없으며 CCSequence 내부에 사용할 수 없습니다.

ko/prog_guide/actions_composition.txt · Last modified: 2011/06/28 04:31 by o_o
Trace: hello_actions basic_concepts labels actions effects tiled_maps actions_ease basic_concepts actions_special actions_composition
Dieses Dokuwiki verwendet ein von Anymorphic Webdesign erstelltes Thema.
CC Attribution-Noncommercial-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0