I'm having little trouble accessing public ivars form the ccTouchesBegan method,
I have this Scene:
class introScene : public cocos2d::CCLayer {
public:
virtual bool init();
static cocos2d::CCScene* scene();
bool autoScroll;
virtual void ccTouchesBegan(cocos2d::CCSet* touches, cocos2d::CCEvent* event);
void skip();
CREATE_FUNC(introScene);
};
and from inside the .cpp file I try to access the variable autoScroll, but it insists that the variable doesn't exist, am I doing anything wrong here ??
void ccTouchesBegan(cocos2d::CCSet* touches, cocos2d::CCEvent* event){
autoScroll = false;
}
This generates: use of undeclared identifier 'autoScroll'
I don't know anything about cocos2d, but I reckon you've defined the method incorrectly as you've missed off the class name. Try this:
void introScene::ccTouchesBegan(cocos2d::CCSet* touches, cocos2d::CCEvent* event){
// ^^^^^^^
autoScroll = false;
}