Follow and callFunc.

来源:互联网 发布:linux 完全关闭安全狗 编辑:程序博客网 时间:2024/05/22 00:28
Sprite *sprite1 = Sprite::create("person/poster_char_xiaohai2.png");sprite1->setScale(0.5f);addChild(sprite1, 1, 1);sprite1->setPosition(0, 0);ActionInterval *action1 = MoveTo::create(3.0f, ccp(visibleSize.width, visibleSize.height));ActionInstant *func = CCCallFuncND::create(this, SEL_CallFuncND(&ActionTest::callBackFunc),(void*)10);Follow *action_follow = Follow::create(sprite1, Rect::ZERO);sprite1->runAction(Sequence::create(action1,func,NULL));this->runAction(action_follow);}void ActionTest::callBackFunc(Node *pSender,void *data){CCLog("every thing is ok.");this->stopAllActions();Sprite *person = (Sprite*)(this->getChildByTag(1));person->runAction(MoveTo::create(2.0f, ccp(100, 100)));}

0 0
原创粉丝点击