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

cocos2dx 定时器 schedule scheduleUpdate scheduleOnce

WBOY
Release: 2016-06-07 15:00:56
Original
1656 people have browsed it

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();



Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template