酷跑类型的游戏, 移动背景会卡主啊, 大伙帮忙看看呗,谢谢了

没做过游戏开发啊, 第一次弄,如果把背景移动的for循环注释的话,就不会卡顿了 。
不知道是什么问题

以下是代码

Defind.js
module.exports = {
BackMoveTime:10,
BackMoveTime2:5,
};

const gg = require(“Defind”);
cc.Class({
extends: cc.Component,

properties: {
  m_Hero:cc.Node,
  m_BtnRoll:cc.Button,
  m_Back:[cc.Node],
  m_Back2:[cc.Node],
  m_Back3:[cc.Node],
},

onLoad () {
    this.m_Hero = this.m_Hero.getComponent(cc.Animation);
    this.m_Hero.play('run');

    this.m_BtnRoll.node.on(cc.Node.EventType.TOUCH_START,this.toucheStart,this);
    this.m_BtnRoll.node.on(cc.Node.EventType.TOUCH_END,this.toucheEnd,this);
    this.m_BtnRoll.node.on(cc.Node.EventType.TOUCH_CANCEL,this.toucheEnd,this);

    for(var i = 0;i<this.m_Back.length;i++){
        var move = cc.moveTo(i*gg.BackMoveTime + gg.BackMoveTime,cc.p(-496,0));
        var seq  = cc.sequence(move,cc.callFunc(this.backMoveEnd,this,"bg1"));
        this.m_Back[i].runAction(seq);
    }

    // for(var i = 0;i<this.m_Back2.length;i++){
    //     var move = cc.moveTo(i*gg.BackMoveTime2 + gg.BackMoveTime2,cc.p(-496,0));
    //     var seq  = cc.sequence(move,cc.callFunc(this.backMoveEnd,this,"bg2"));
    //     this.m_Back2[i].runAction(seq);
    // }


    // for(var i = 0;i<this.m_Back3.length;i++){
    //     var move = cc.moveTo(i*gg.BackMoveTime2 + gg.BackMoveTime2,cc.p(-496,0));
    //     var seq  = cc.sequence(move,cc.callFunc(this.backMoveEnd,this,"bg2"));
    //     this.m_Back3[i].runAction(seq);
    // }
},
backMoveEnd:function(target,data){
    target.setPosition(496,0);
    var moveTime;
    if(data=="bg1"){
        moveTime = gg.BackMoveTime;
    }else if(data=="bg2"){
        moveTime = gg.BackMoveTime2;
    }
    //背景移动的时候需要,双倍时间
    var move = cc.moveTo(moveTime*2,cc.p(-496,0));
    var seq  = cc.sequence(move,cc.callFunc(this.backMoveEnd,this));
    target.runAction(seq);
},
toucheStart:function(){
    if(this.m_Hero.currentClip.name=="jump"){
        return;
    }
    
    this.myherfoRull("roll");
},
toucheEnd:function(){
    this.myherfoRull("run");
},
onAnimationClick:function(target,data){
    if(data=="roll"){
        
    }else if(data=="jump" && this.isCanChangeClip("jump")){

        this.myherfoRull('jump');
        var moveTo = cc.moveTo(0.3,-113,38).easing(cc.easeCubicActionInOut());
        var moveDown = cc.moveTo(0.3,-113,-51).easing(cc.easeCubicActionIn());

        //回调函数,调用以后执行callFunc方法 bind(this);传递当前this对象 
        var callBack = cc.callFunc(this.callBackDownOver.bind(this),this.m_Hero.node,this);
        var seq = cc.sequence(moveTo,moveDown,callBack);
        this.m_Hero.node.runAction(seq);

    }
},
//回调函数获取this对象 ,并且获取hero.node对象的动画参数
callBackDownOver:function(){
    var anim = this.m_Hero.node.getComponent(cc.Animation);
    anim.play('run');
},
myherfoRull:function(playname){

    if(this.isCanChangeClip(playname)==false){
        return;
    }
    if(playname=="roll"){
        this.m_Hero.node.setPosition(cc.p(-113,-58));
    }else if(playname=="run"){
        this.m_Hero.node.setPosition(cc.p(-113,-51));
    }
    this.m_Hero.play(playname);
},

isCanChangeClip:function(playname){
    

    if(playname=="roll"){
        if(this.m_Hero.currentClip.name=="jump"){
            return false;
        }else if(this.m_Hero.currentClip.name=="run"){
            return true;
        }
    }else if(playname=="jump"){
        if(this.m_Hero.currentClip.name=="run"){
            return true;
        }else {
            return false;
        }
    }else if(playname=="run"){

    }
    return true;
},

start () {

},

// update (dt) {},

});

这个是项目的层级目录


这个是效果图