Dieses Dokuwiki verwendet ein von Anymorphic Webdesign erstelltes Thema.

액션 (Actions)

액션

액션은 한 CCNode 오브젝트에 명령을 내리는 것과 같습니다. 보통 position, rotation, scale 등과 같이 객체의 속성을 변경합니다. 시간 간격 동안 속성이 수정된다면, CCIntervalAction 액션이나 CCInstantAction 액션일 것입니다.

예를 들면, Move By 액션은 시간 기간 동안 position 속성을 수정하는 IntervalAction입니다.

예제 :

# 스프라이트를 50 픽셀 오른쪽으로 이동하며 2초간 10 픽셀 이동.
[sprite runAction: [CCMoveBy actionWithDuration:2 position: ccp(50,10)]];

CCIntervalAction 액션은 재미있는 몇 가지 재미있는 기능을 포함합니다.

  • 아래의 액션은 time-altered 액션에 의해 가속 기능을 사용할 수 있습니다.
    • CCEaseIn
    • CCEaseOut
    • CCEaseInOut
    • CCSpeed
    • Etc. (EaseActionsTest.m 예제에 좀 더 많은 정보를 볼 수 있습니다.)
  • 모든 연관 액션('By'로 끝나는)과 지정 액션('To'로 끝나는)은 반대되는 액션([action reverse])이 존재합니다.

여러분은 CCActionManager를 사용하여 정지/동작 액션을 사용할 수 있습니다.

# 정지 액션
[[CCActionManager sharedManager ] pauseAllActionsForTarget: sprite ] ;
 
# 동작 액션
[[CCActionManager sharedManager ] resumeAllActionsForTarget: sprite ] ;

기본 액션 (Basic Actions)

기본 액션은 기본 속성을 수정하는 액션입니다.

예제:

CGSize s = [[CCDirector sharedDirector] winSize];
 
id actionTo = [CCMoveTo actionWithDuration: 2 position: ccp(s.width-40, s.height-40)];
id actionBy = [CCMoveBy actionWithDuration: 2 position: ccp(80,80)];
 
[sprite1 runAction: actionTo];
[sprite2 runAction: actionBy];

리버스 액션 (Reverse Action)

거의 모든 액션은 reverse 메소드가 구현되어 있습니다. 기본적으로 반대로 동작하는 새 액션을 수행합니다.

예제:

id move = [CCMoveBy actionWithDuration:2  position: ccp(80,80)];
 
id move_reverse = [move reverse];

move_reverse 액션은 2만큼, ccp(-80,-80)값 만큼의 CCMoveBy액션이 될 것입니다.

ko/prog_guide/actions.txt · Last modified: 2011/06/23 13:10 by o_o
Trace: templates actions_ease 0_8_1 lesson_1._install_test hello_world hello_events hello_actions basic_concepts labels actions
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