2013-02-14 3 views
0

저는 Kobold2D + TexturePacker를 사용합니다 (둘 다이 시점에서 마지막 버전입니다).pvr 텍스처에서 CCSprites의 이상한 위치 지정

spriteWithFile : 메서드를 사용하여 CCSprite 객체를 만들고 필요한대로 배치하면 잘 보입니다.

spriteWithFile:

하지만 다른 방법

CGSize screenSize = [CCDirector sharedDirector].winSize; 

background = [CCSprite spriteWithFile:@"dir_bg.png"]; 
background.position = CGPointMake(screenSize.width - background.texture.contentSize.width/2 - 10, background.texture.contentSize.height/2 + 10); 

[self addChild:background]; 

controller = [CCSprite spriteWithFile:@"dir_big.png"]; 
controller.position = background.position; 

[self addChild:controller]; 

는 spriteWithSpriteFrameName를 사용하여 텍스처의 로딩 :, 개체가 예상대로 배치되지 않는다.

[CCTexture2D PVRImagesHavePremultipliedAlpha:YES]; 
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"Textures.plist"]; 

CGSize screenSize = [CCDirector sharedDirector].winSize; 

background = [CCSprite spriteWithSpriteFrameName:@"dir_bg.png"]; 
background.position = CGPointMake(screenSize.width - background.texture.contentSize.width/2 - 10, background.texture.contentSize.height/2 + 10); 

[self addChild:background]; 

controller = [CCSprite spriteWithSpriteFrameName:@"dir_big.png"]; 
controller.position = background.position; 

[self addChild:controller]; 

spriteWithSpriteFrameName:

왜 ?

+0

: 배경 플러스 2 개의 다른 "컨트롤"스프라이트를; 이것은 내가 게시 한 2 개의 이미지에서 읽은 것입니다. 반면에'spriteWithFile'에 대한 호출은 두 번 밖에 볼 수 없습니다. 나는 아무것도 없어? – sergio

+0

일부 TexturePacker 설정으로 인해 자르기 설정 (플러시 위치 사용 안 함)이 발생할 수 있습니다. 스프라이트 속성이 동일하고, 주로 position, anchorPoint 및 contentSize가 동일한 지 확인하십시오. 서로 다른 경우 질문을 업데이트하십시오. – LearnCocos2D

+0

세르지오 (Sergio)는 방향 제어의 CCNode를 하나만 요구하며 두 개의 CCSprite (배경 및 휠)를 필요로합니다. 일반적으로지도의 배경을 가진 CCLayer와 CCSprites가있는 두 개의 CCNode가 있습니다. – bezigon

답변