Question

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?

Was it helpful?

Solution

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

You can look here for more detail

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top