!cocos2d 重复添加action事件

时间:2021-09-05 16:44:34

当点击的时候,如果不是按照开始点击计算的,那么持续点击会导致不会变大。

void Piece::setActived(bool active)
{ _actived = active;
CCAction *scale;
if (_actived)
{
scale = CCScaleTo::create(0.2, 1.2);
}
else
{
scale = CCScaleTo::create(0.2, 1);
}
this->runAction(scale); }
void Piece::setActived(bool active)
{
if(_actived==active)
{
return ;
}
else
{
_actived = active;
CCAction *scale;
if (_actived)
{
scale = CCScaleTo::create(0.2, 1.2);
}
else
{
scale = CCScaleTo::create(0.2, 1);
}
this->runAction(scale);
}
}