I want to access a variable from 1 layer to another.
I tried implementing few things but all failed.
CC_SYNTHESIZE(int, _mNumber, mNumber);
It gave bad access in other layer when I called
@ int score = ((Samplecocos2dx *)this~~>getParent~~>getChildByTag)
2. I used a method to return the score. It also gave bad access
3. I set tag for the layer itself.
this->getParent()->addChild(GameOverLayer::node(), 2, mNumber);
When I tried to get
int score = this->getTag();
Can anyone give me a solution???