cocos creator action之jumpTo、jumpBy

cocos creator中,jumpTo、jumpBy的使用方法例子:

cc.Class({
    extends: cc.Component,
    properties: {
        move: cc.Node,
    },
    start() {
        this.moveT()
    },
    moveT() {
        this.move.on('touchstart', function() {
            // this.startPoint = event.getLocation();
            cc.log('moveT')
        })
        this.move.on('touchend', (event) => {
            // jumpBy
            // cc.jumpBy(time,cc.v2(x,y),height,count)
            // cc.jumpBy(时间,停止跳跃时的坐标:原坐标 + (x,y)的值,跳跃高度,跳跃次数)
            // var actionJumpBy = cc.jumpBy(2, cc.v2(100, 100), 30, 5)
            // this.move.runAction(actionJumpBy)

            // jumpTo 
            // cc.jumpTo(time,cc.v2(x,y),height,count)
            // cc.jumpTo(时间,停止跳跃之后的坐标,跳跃高度,跳跃次数)
            var actionJumpTO = cc.jumpTo(1, cc.v2(100, 100), 30, 5)
            this.move.runAction(actionJumpTO)   //调用
        });
    }
});

你可能感兴趣的:(cocos,creator,cocos,creator,action,cc.jumpTo,cc.jumpBy)