cc.Node.schedule not working as I expected

cc.Node.schedule not working as I expected
0.0 0


Hi everyone! I am using jsbindings for my game but confronting an issue with cc.Node.schedule method. I need to use

my_sprite.schedule( my_function, 1, cc.REPEAT_FOREVER, 0);

I was expecting that schedule will call my function with 0 delay and then repeat calling it every second, but it isn’t. Then I did the following test:

my_sprite.schedule( my_function, 10, cc.REPEAT_FOREVER, 5);

And what schedule is doing: Waits 5 second as my delay parameter says but then delays 10 more for the fist call. I tought that the autorepeat delta time (first parameter) was used as delay between every call but not including the first call.

Is this behaviour what it should be expected or is this a bug?
Thank you in advance for any help.


I tested this case with Xcode and cocos2d-x v2.2.1, the result was: my_function was first excuted after 5s, and then once every 10s.
So I think the result right.


I am sorry, I never clarified. I am using cocos2d-x v3.0alpha0. I did a second check and I did confuse something. I get the same results as you do, so that is working ok.
But what I don’t understand is when you use delay time as 0s instead of 10s (2nd parameter). It waits 10s before executing my_function for the first time instead of executing with 0 delay for first call.

my_sprite.schedule( my_function, 10, cc.REPEAT_FOREVER, 0);