Schedule function is slow

Schedule function is slow
0

#1

I’m using this schedule function: http://docs.cocos2d-x.org/creator/manual/en/scripting/scheduler.html

I have it set to repeat my function (changing the opacity of something) every 0.003 seconds. Ever since the update, the schedule function seems to not work properly. It repeats my function very slowly, even when I set it to repeat every 0.00001 seconds, or 0.00000000001 seconds (it probably hits a cap).

Any ideas of what happened, or alternatives?


#2

Why you don’t use action for animation?

If you really need to do that manually then use update in your class:

    var MyClass = cc.Class.extend ({
    ctor : function()
    {
        cc.director.getScheduler().scheduleUpdate(this, 0, false);
    },

    update : function(dt) {
        // this function will be called each frame, ideally 60 times per second
    },

#3

I’ll take a look at both, as I am pretty inexperienced. Looks like I can easily use fade in and fade out, lol. Thanks.