I have a Question, I added an CCSprite with Image, now I want to work on this CCSprite in XCode, but I don't know how can I link it? Yeah I know thats, a easy question, but not for me, Can you help me? Have I used a Custom Class name?
Asked
Active
Viewed 184 times
-1
-
Are you trying to subclass ccsprite or using ccsprite as is without subclassing? – johnny peter Dec 25 '14 at 06:31
-
for each ccSprite create a subclass? , – J0k3R Dec 25 '14 at 07:03
-
I created a subclass, but i can't change anything, like color or so – J0k3R Dec 25 '14 at 07:10
-
Not needed. If you want to add more functionality then subclass, else just add sprite to the node, give a name to it in docrootvar and in Xcode use (CCSprite*)[self getChildByName:@"spritename" recursively:YES] on the node in which you added the sprite to get a reference. – johnny peter Dec 25 '14 at 07:11
-
Nothing happen, I uploaded my steps, maybe i did something wrong, I tried to change the color, but If i tested, it is still white. – J0k3R Dec 25 '14 at 07:19
-
use -(void)didLoadFromCCB instead of -(id)init. – johnny peter Dec 25 '14 at 07:22
-
hmm, okay, anything I will do wrong, again nothing happen... I got an error message on Console. 2014-12-25 08:24:16.346 test[41943:739434] CCBReader: Couldn't find member variable: ball1 2014-12-25 08:24:16.347 test[41943:739434] CCBReader: Couldn't find member variable: ball2 – J0k3R Dec 25 '14 at 07:27
-
Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/67659/discussion-between-johnny-peter-and-j0k3r). – johnny peter Dec 25 '14 at 07:29
2 Answers
0
In the example above you have set a member variable, and not the name property of the sprite.
You can either create a CCSprite* ball1;
member variable in your header file or set the name property of the sprite and use your existing code.

Vik
- 231
- 2
- 6
0
I have to set a Name of this CCSprite not a "Doc root var" or Custom Class. That was, what I had to do. No it is still working. But Thanks all for helping

J0k3R
- 303
- 1
- 14