Animations
Frame Animation
아래와 같이 여러개의 이미지 파일로 애니메이션을 만들 수 있다.
Note that CCAnimation is composed by sprite frames, delay time per frame, durations etc, it's a pack of "data". While CCAnimate is an action, it is created base on CCAnimation object.
Sprite Sheet Animation
위 에니메이션 방식은 이해하기 쉽지만, 실제 게임에서는 잘 사용되지 않습니다, 대신 스프라이트 시트 에니메이션을 일반적으로 사용합니다.
다음은 일반적인 스프라이트 시트입니다. 그것은 애니메이션 스프라이트 프레임 시퀀스이거나 같은 장면에서 사용될 이미지 팩이 될 수있다.
Creating from .png and .plist file
그다음에 너는 CCSpriteFrameCache 싱글톤 클래스를 사용하여 plist 파일을 로드합니다.
CCSpriteBatchNode와 프레임이로드 및 스프라이트 시트를 장면에 추가되면, 당신은 "createWithSpriteFrameName"방법을 사용하고, CCSpriteBatchNode 자식으로 추가하여 이러한 프레임을 사용 스프라이트를 만들 수 있습니다 :
createWithSpriteFrameName이 메서드는 posit 파일을 이용하여 해당되는 사각형 영역을 찾을수 있습니다.
CCArray 오브젝트에 에니메이션 프레임을 더합니다. 에니메이션 사이즈는 14 프레임이고 우리는 이것을 사용하면 됩니다.
마지막으로 우리는 CCAnimate 만들고 CCSprite에 runAction을 해줍니다. CCRepeatForever를 이용해서 무한으로 에니메이션을 돌릴수 있습니다.
File animation
CCAnimationCache can load a xml/plist file which well describes the batch node, sprite frame names and their rectangles. The interfaces are much easier to use.
'잡다한것들전부 > Basic Concepts' 카테고리의 다른 글
| [Effects] cocos2-dx 이펙트에 대해서 알아보자! (0) | 2014.01.09 |
|---|---|
| [Basic Concepts] Director, Scene, Layer, Sprite 개념 정리 (0) | 2014.01.09 |
| [Coordinate System] cocos2d-x 좌표 시스템 (0) | 2014.01.09 |
| [Animations] cocos2d-x 에니메이션 적용하기 (0) | 2014.01.08 |
| [Action] cocos2d-x 액션 사용법 (0) | 2014.01.08 |
| cocos2d-x 기본 컨셉 (0) | 2013.09.23 |


