문제

CCSprite class reference

I need an object in which I can draw and it also has fixed rect size with position. It seems CCSprite has everything I need but it can be initialized with picture only.

CCLayer can be initialized without picture but it hasn't rect. I have found content size only.

So what to do if I need an object similar to CCSprite, but I don't wan't to use pictures?

EDITED

I mean I need a Rect to detect touches. And CCSprite can be defined with a static method spriteWithTexture:rect:, where I can manually set its rect. But what to do if I don't want to set texture, but rect only?

도움이 되었습니까?

해결책

You can create a sub class of CCNode and override its draw method.

You can look here for more detail

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top