Scheduled Functions

Scheduled Functions
0.0 0


I have a function that I scheduled to run at a certain interval in my init function:

float spawnInterval = 1.0f;
this->schedule(schedule_selector(MyScene::enemySpawner), spawnInterval);

I want to know if it is possible to change the schedule time later on in my game (e.g. make it call more often after a click) and how I would do this? :slight_smile:

Any advice appreciated


According to CCNode.h:

        /** schedules a custom selector with an interval time in seconds.
         If time is 0 it will be ticked every frame.
         If time is 0, it is recommended to use 'scheduleUpdate' instead.
         If the selector is already scheduled, then the interval parameter
         will be updated without scheduling it again.
        void schedule(SEL_SCHEDULE selector, ccTime interval);


Sweet, thanks alot