Hi,
I have got a class MainScene.cpp which has got a instance variable *world . In the init of this class MainScene.cpp, I want to do the “C++ translation” of the following iOS code:
<pre>
*ground = [[[Ground alloc] initWithWorld:*world];
</pre>
I wrote:
<pre>
*ground ->initWithWorld(*world);
</pre>
My ground class is like this:
ground.h
<pre>
class Terrain : public cocos2d::CCNode
{
protected:
b2World **world;
//some other code…
}
bool Terrain::initWithWorld(b2World *aWorld) {
if (CCNode::node())
{
_world = aWorld;
//some other code...
}
return true;
}
I have got a crash on _world = aWorld; “Program received signal”EXC_BAD_ACCESS“”
I really don’t understand why…
Can anyone help me ?
Thanks a lot !