본문 바로가기
모바일 개발/iOS

Cocos2d | 이미지 관련 클래스

by KISCH 2020. 2. 20.
반응형


코코스



CCSprite


[CCSprite spriteWithFile:@"..." rect:CGRectMake( , , , )];


❛ 메서드
- setPosition : 
- setScaleX :
- setScaleY :
- setTextureRect : [... setTextureRect:CGRectMake(0, 0, 150, 150)];
- setColor :
- spriteWithFile :
- spriteWithFrameName :

 스프라이트 교체
[apleS setDisplayFrame:[[CCSpriteFrameCacheharedSpriteFrameCache]spriteFrameByName:@"xxx.png"]];

 sharedSpriteFrameCache
sharedSpriteFrameCache는 싱글톤으로 앱이 실행되는 동안 공유되는 스프라이트 프레임 캐시이므로, CCLayer객체가 종료될 때 객체내에서 로드한 스프라이트 프레임을 모두 삭제
ex) 
-(void) onExit{ 
[super onExit]; 
[CCSpriteFrameCache sharedSpriteFrameCache] removeUnusedSpriteFrames];
}


CCAnimation

initWithAnimation : 애니매이션을 초기화

- actionWithAnimation : alloc, init, autorelease


파티클 디자이너

particle = [CCParticleSystemPoint particleWithFile:@"xxx.plist"];

particle.scale = 5.0;                       // 파티클 전체 크기
particle.duration = 3.0;                 // 파티클 lifetime
particle.position = ccp(self.sprCharacter.contentSize.width/2.0
self.sprCharacter.contentSize.height-60);                                    // 파티클 위치
[sprCharacter addChild:particle z:15];   // 파티클 붙이기(캐릭터를 따라 다니게)!






반응형

'모바일 개발 > iOS' 카테고리의 다른 글

Xcode | 설치 및 환경설정  (0) 2020.02.21
Cocos2d | 트러블 슈팅  (0) 2020.02.20
Cocos2d | 기타 클래스  (0) 2020.02.20
Cocos2d | CCAction 클래스  (0) 2020.02.20
Cocos2d | CCNode 클래스  (0) 2020.02.20
Cocos2d | 기초  (0) 2020.02.19
Cocos2d | 스프라이트 애니메이션  (0) 2020.02.19
Cocos2d | 씬의 흐름  (0) 2020.02.19

댓글