背景循环

2019-05-04  本文已影响0人  Vincy_ivy

超级开心,终于搞定了代码

update: function (dt) {
    var parent_width = this.node.parent.width;
    console.log(parent_width);
    this.bg1.x -= this.bg_roll_speed;
    this.bg2.x -= this.bg_roll_speed;
       console.log(this.bg1.x, this.bg2.x);
    if (this.bg1.x <= -parent_width) {
        //var bg2_width = this.bg2.x;
        this.bg1.x = parent_width ;
    }
    if (this.bg2.x <= -parent_width) {
       // var bg1_width = this.bg1.x;
        this.bg2.x = parent_width ;

    }
},
上一篇下一篇

猜你喜欢

热点阅读