Meuk Light
Meuk Light

Reputation: 1005

Sprite Builder can't find the variable define in objective c class

I am making a game given in makeagamewithus.com named "PeevedPenguins".
I put _physicsNode variable in spritebuilder for gameplay scene and put CCPhysicsNode *_physicsNode in implementation class Gameplay as given in this Link.
But get an error CBReader: Couldn't find member variable: _physicsNode

Upvotes: 3

Views: 996

Answers (2)

Tibor Udvari
Tibor Udvari

Reputation: 3012

You we're not declaring your ivars correctly in your class.

Here is the problematic snippet from your code.

@implementation Gameplay
CCPhysicsNode *_physicsNode;
CCNode *_catapultArm;

You forgot the brackets, here is your corrected code.

@implementation Gameplay
{
    CCPhysicsNode *_physicsNode;
    CCNode *_catapultArm;
}

Upvotes: 3

ronm333
ronm333

Reputation: 131

In spritebuilder make sure the pop-up menu is set to "Doc root var". Check your capitalization and spelling. Make sure the superclass of Gameplay is CCNode.

Upvotes: 0

Related Questions