How to call a void function inside the sequence?
Cocos2d-x v3-
nightrobinLikes 0Problem Description
Good day,
I have this:
void TheClass:Method1() { cocos2d::MoveBy* moveAction = cocos2d::MoveBy::create( 3, cocos2d::Vec2( 0, 10 ) ); cocos2d::Sequence* theSequence = cocos2d::Sequence::create(moveAction, TheClass:Method2, nullptr); someSprite->runAction(theSequence); } void TheClass:Method2() { // run some code }
Why can't I run this?
I am using coco2d-x ver 3.8.
Thank you
-
Sonar Systems adminLikes 0
You want to use the CallFunc action, you can see more information on our Cocos API Guide http://cocos.sonarlearning.co.uk/docs/actions#section--call-function-call-function-allows-a-function-to-be-called-at-the-same-place-an-action-would-be-could-so-a-sequence-for-example
This reply has been verified.
-
nightrobinLikes 0
Thanks.
It solved my problem. I also used the test codes from test/test-cpp of cocos2d-x folder.
-
Sonar Systems adminLikes 0
Great to hear mate, feel free to post anymore questions you may have.
Login to reply