1.schedule_selector 定义为
typedef void (CCObject::*SEL_SCHEDULE)(float);
新版本更新为float,非ccTime
2.随机数
srand(time(NULL)); srand(millisecondNow()) int ran = CCRANDOM_0_1()*100;
调用之前需要调用一下srand(xx),参数可以为c标准库的time(NULL),或者下面这个或者系统毫秒的时间函数
#include "cocos2d.h" using namespace cocos2d; long millisecondNow() { struct cc_timeval now; CCTime::gettimeofdayCocos2d(&now, NULL); return (now.tv_sec * 1000 + now.tv_usec / 1000); }