cocos2d x - Passing parameter to schedule_selecter -


hey guys using schedule_selecter in cocos2dx project, having 7 different int values. generating random value among these 7 values. want pass random value function after interval. using schedule_selecter make call after interval not allow me pass value. how can this???

ex.

int random_val = arc4random() % 7;

...

function_selected_value(int random_val) { .... }

i want pass random_val function_selected_value using schedule_selecter

thnx in advance ..

schedule_selecter not allow pass data functor. instead can assign value member variable , access there in callback function.

// scheduling function interval of 1 seconds. float interval = 1.0f; // interval call scheduler function.   ccnode::schedule(schedule_selector(myclass::schedulefunction), interval);  void myclass::schedulefunction(float dt) {     // use random number related code here } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -