Creator 的暂停动作问题

// 更新行走速度
updateWalkSpeed: function(){
    if(this.action === null){
        return false;
    }
    var actionManager = new cc.ActionManager();
    // 如果有停止速度的buff 则设置行走状态为假
    if(this.distanceSpeedEffect == 'stop' || this.timeSpeedEffect =='stop'){
        actionManager.pauseTarget ( this.action );
        return;
    }
    actionManager.resumeTarget ( this.action );
    this.walkSpeed = this.walkBaseSpeed + this.timeSpeedEffect + this.distanceSpeedEffect;
    // 若距离速度影响使速度小于等于最小速度,则调用最小速度
    if(this.walkSpeed < this.minWalkSpeed){
        this.walkSpeed = this.minWalkSpeed;
    }
}

我把参数改成this.node 也还是不可以 郁闷至极。
原来想用this.node.pause(); 提示这个方法已被废弃

没有看到执行动作的代码,同时,pauseTarget 的参数应该是 cc.Node

// 人物行走
runWalkAction:function(startPos,endPos,mapTileSize){
    // 若果角色的属性为不行走,则返回假
    if(this.isWalk === false){
        return false;
    }
    // 更改角色当前的行走点ID
    this.walkID += 1;
    // 根据行走距离更新角色身上的buff
    this.updateBuffByDistance();
    // 获得行走方向
    var turnCharactor = cc.callFunc(this.trunDirection, this, this.getDirection(startPos,endPos));
    var moveAction = this.getWalkMoveAction(startPos,endPos,mapTileSize);
    var callback = cc.callFunc(function(){
        // 向游戏控制组件发送行走结束事件
        this.node.dispatchEvent(new cc.Event.EventCustom('walkReturn', true));
    }, this);
    var action = cc.sequence(turnCharactor,moveAction,callback);
    this.node.runAction(action);
},

// 更新行走速度
updateWalkSpeed: function(){
    var actionManager = new cc.ActionManager();
    // 如果有停止速度的buff 则设置行走状态为假
    if(this.distanceSpeedEffect == 'stop' || this.timeSpeedEffect =='stop'){
        actionManager.pauseTarget ( this.node );
        return;
    }
    actionManager.resumeTarget ( this.node );
    this.walkSpeed = this.walkBaseSpeed + this.timeSpeedEffect + this.distanceSpeedEffect;
    // 若距离速度影响使速度小于等于最小速度,则调用最小速度
    if(this.walkSpeed < this.minWalkSpeed){
        this.walkSpeed = this.minWalkSpeed;
    }
}

虽然我给改成了 this.node 可是还是不起作用

不应该新创建一个 actionManager,你的动作是在默认 actionManager 上执行的,获取方法:

var actionManager = cc.director.getActionManager();

太感激了,然后我想给你们的文档提一点小小的意见。因为文档的actionManager的部分的实例 就有 var mng = new cc.ActionManager(); 所以被误导了,希望能修改下。

在哪篇文档中?麻烦提供下链接,我们修正一下

http://www.cocos.com/docs/creator/api/classes/ActionManager.html

示例那里

哦哦,这里是为了展示给用户,你们可以自己创建自己的 ActionManager,不过默认 Node 使用的就是 director 的默认 ActionManager

this.mStart= this.node.getChildByName(“Image1_Start”);
ScreenMove= cc.repeatForever(cc.sequence(cc.moveTo(100, cc.p(-10000, 0))))
this.mStart.runAction(ScreenMove);

var actionManager = cc.director.getActionManager();
actionManager.pauseTarget(this.mStart.node);

仍然没效啊.动作正常运行.
我的creator版本是1.2.1 rc1

其实action这一块,我建议做成一个action component,这样就不会出现这些问题了,这个节点的所有动作暂停,继续,减速,加速,倒退,都在这个组件接口里。

怎么创建自己的ActionManager? 能提供下简单写法吗。 谢谢

试过,可以了.谢谢

var actionManager = cc.director.getActionManager();
actionManager.resumeTarget(this.rotatingNode); //恢复动作 怎么不行。暂停是可以的

可以为每个node分配一个不同的actionmanager吗。我有需求要控制不同node上action的速度,或者直接跳过一段时间。