如何从CallFunc获取更新的参数? (cocos2d-x V3.0)

时间:2018-08-26 04:10:18

标签: cocos2d-x

我想从CallFunc更新参数时间。但是,我从CallFunc更新的时间始终为零。即DelayTime::create(updatedTime)为零。

有人知道如何使用CallFuncDelayTime中的参数吗?

1 个答案:

答案 0 :(得分:0)

1 /请提供您的代码。我们不明白您的问题。

2 / CallFuncDelayTime都返回一个cocos2d :: Action,您不能在彼此内部调用它们。

3 / CallFunc:
http://www.cocos2d-x.org/docs/api-ref/cplusplus/v3x/d3/d32/classcocos2d_1_1_call_func.html
函数定义:static CallFunc* create (Ref *target, SEL_CallFunc selector)
示例:

using namespace cocos2d; class A() : Node //(或任何继承Ref的内容)
{/*...(defined function f())...*/}

A *a = new A();
CallFunc* callFunc = CallFunc::create(a, SEL_CallFunc(&A::f));
a->runAction(callFunc);

DelayTime:
http://www.cocos2d-x.org/docs/api-ref/cplusplus/v3x/d5/d58/classcocos2d_1_1_delay_time.html
函数定义:static DelayTime* create(float d)
示例:

A *a = new A();
DelayTime* wait = DelayTime::create(4);
a->runAction(wait); // this is useless, you must put a DelayTime in a Sequence

p / s:序列也是动作。要创建序列,请使用
Sequence* seq = Sequence::create(action1, action2, action3, NULL);