您的位置:首页 > 移动开发 > Cocos引擎

cocos2d-x 使用schedule实现倒计时

2013-11-25 12:45 447 查看
//实现倒计时
this->_down_Label =CCLabelTTF::create();
CCString* downStr = CCString::createWithFormat("%d",this->_dowmTime);
this->_down_Label->setString(downStr->m_sString.c_str());
this->addChild(this->_down_Label,3);
this->_down_Label->setPosition(ccp(this->_shootCard->getPosition().x,this->_shootCard->getPosition().y));
this->_down_Label->setFontSize(30);

//更新倒计时
void GameLayer::downTime(float dt)
{
this->_dowmTime =this->_dowmTime -1;
CCString* downStr = CCString::createWithFormat("%d",this->_dowmTime);
this->_down_Label->setString(downStr->m_sString.c_str());
}

schedule(schedule_selector(GameLayer::downTime),1.0f);







内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: