2011-02-28 3 views
0

이 스프레드 시트를 이렇게 호출 할 때 배열에 스프라이트가 있습니다.배열에있는 객체에서 객체 위치를 호출합니까?

[c1 objectAtIndex:0]; 

스프라이트의 위치를 ​​다음과 같이 호출하고 싶습니다.

[c1 objectAtIndex:0].position.x; 

이 작업을 수행 할 방법이 있습니까? 스프라이트 위치가 포함 된 다른 배열을 만들어야합니다. 여기에 내 문제가있다 :

if (mySpritePointers [nSprite]->position.x == myXPoints [nPoint] && mySpritePointers[nSprite]->position.y == myYPoints [nPoint]) { 

'구조체 CCSprite'오류가 발생했습니다 '위치'라는 구성원이

답변

0

당신은 캐스트와 objectAtIndex의 값을 메서드를 호출 할 수 있습니다라는 이름의 멤버가 없습니다 : 여기 내 문제입니다.

((CCSprite *)[c1 objectAtIndex:0]).position.x; 

또는

CCSprite *sprite = (CCSprite *)[c1 objectAtIndex:0]; 
sprite.position.x 
+0

감사합니다 친구는 내가 연령대에 붙어 있었어요. – Dangermouse

관련 문제