I have a class which owns a CCSprite object called mSprite. I gave it a series of actions like so:
void Ball::dropBall( ) {
isDropping = true;
ccBezierConfig bezierConfig = ccBezierConfig( );
bezierConfig.endPosition = getDropPoint( ); // returns a CCPoint object
bezierConfig.controlPoint_1 = getControlPointA( ); // CCPoint
bezierConfig.controlPoint_2 = getControlPointA( ); // CCPoint
CCBezierTo * bezierAction = CCBezierTo::create( 1.0f, bezierConfig );
CCEaseBounceOut * bounceAction = CCEaseBounceOut::create( bezierAction );
CCCallFunc * actionEndCall = CCCallFunc::create( mSprite, callfunc_selector( Ball::dropEnd ) );
mSprite -> runAction( CCSequence::create( bounceAction, actionEndCall, NULL );
}
And this is the Ball::dropEnd( CCNode ) function
void Ball::dropEnd( CCNode * pSender ) {
isDropping = false;
cout << "isDropping? " << isDropping << endl;
}
It runs good. The string “i@sDropping?@ 0” is shown. But the problem is, if I use isDropping
on a check after the action, it returns true
, and not false
. The new value is not saved when the action ends.
I am thinking the problem lies in the line
CCCallFunc * actionEndCall = CCCallFunc::create( mSprite, callfunc_selector( Ball::dropEnd ) );
since I’m passing a CCSprite and not a CCLayer. Any thoughts?