Home >Database >Mysql Tutorial >cocos2dx 定时器 schedule scheduleUpdate scheduleOnce

cocos2dx 定时器 schedule scheduleUpdate scheduleOnce

WBOY
WBOYOriginal
2016-06-07 15:00:561652browse

1. schedule a. 启用: this-schedule(schedule_selector(HelloWorld::Move),1.0f); b. 停用: this-unschedule(schedule_selector(HelloWorld::Move)); c.timeProc: void Move(float dt); void HelloWorld::Move(floatdt) { CCLOG(Tick! Tick!); } 2. sche

1. schedule

a. 启用:this->schedule(schedule_selector(HelloWorld::Move),1.0f);

b. 停用:this->unschedule(schedule_selector(HelloWorld::Move));

c.timeProc:void Move(float dt);

void HelloWorld::Move(floatdt)

{

    CCLOG("Tick! Tick!");

}


2. scheduleUpdate

a. 启用:this->scheduleUpdate(); 

b. 停用:this->unscheduleUpdate();

c.timeProc:void Update(float dt);

voidHelloWorld::Update(float dt) // 函数名必须为Update,规定

{

    CCLOG("Tick! Tick!");

}


3. scheduleOnce

a. 启用:this->scheduleOnce(schedule_selector(HelloWorld::Move),1.0f);

b. 停用:响应一次之后自动停止


4.停止所有定时器:this->unscheduleAllSelectors();



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn