
基本上玩过动作游戏普通攻击也有很多个动作,我想实现这个效果但是卡在攻击次数&状态监测上
比如普通攻击1动作为A1,普通攻击第二招为A2,第三招为A3,蓄力招数为A4,都已经扔到动画缓存里了
之后是检测
这算法有问题啊,求帮助,有好点的算法么,蓄力的倒是实现了,而不同攻击没法实现类似DNF的效果……
void ContButton::touchBegan()
{
isTouch=true;
//处理长按事件
this->schedule(schedule_selector(ContButton::updatelongprogress),1);
switch (touchCounts)
{
case 1:
this->scheduleOnce(schedule_selector(ContButton::updateDoubleDelay), 0.25);
onDoubleClick();
break;
case 2:
onThreeClick();
break;
default:
this->scheduleOnce(schedule_selector(ContButton::updateSingleDelay), 0.25);
onSingleCLick();
break;
}
}
void ContButton::touchEnded()
{
isTouch=false;
pressTimes=0;
this->unschedule(schedule_selector(ContButton::updatelongprogress));
//如果刚完成长按事件 则把按下次数清零 长按状态置空 直接返回 不继续执行
if (m_longProgress )
{
touchCounts=0;
m_longProgress=false;
return;
}
//做连击判断
switch (touchCounts)
{
case 1:
this->unschedule(schedule_selector(ContButton::updateSingleDelay));
touchCounts++;
//onDoubleClick();
break;
case 2:
this->unschedule(schedule_selector(ContButton::updateDoubleDelay));
//onThreeClick();
touchCounts=0;
break;
default:
touchCounts++;
//onSingleCLick();
break;
}
}