cc.tween(this.node)
.by(1, { position: cc.v2(200, 0)})
.by(1, { position: cc.v2(-200, 0)})
.repeatForever()
.start();
请问该如何写才好?
cc.tween(this.node)
.by(1, { position: cc.v2(200, 0)})
.by(1, { position: cc.v2(-200, 0)})
.repeatForever()
.start();
请问该如何写才好?
用 to 可能好一点,用 by 把速度改快,有时候位置会越来越偏,非常明显
cc.tween(this.node)
.to(1, { position: cc.v2(200, 0)})
.to(1, { position: cc.v2(-200, 0)})
.repeatForever()
.start();
这样写,也只是能循环一次,不能重复执行啊, repeatForever 无法重复运动啊
这里的repeatForever应该是重复执行了.to(1, { position: cc.v2(-200, 0)}),而不是前两个.to。 你可能应该需要用一个sequance把这两个to操作先框起来
嗯,我用这种,弄个重复1万次,也相当于无限循环了,
cc.tween(this.node).repeat(10000,
cc.tween()
.to(1, { position: cc.v2(200, 0)})
.to(1, { position: cc.v2(-200, 0)})
).start();
cc.tween(this.node).repeatForever(
cc.tween().to(1, { position: cc.v2(200, 0)}).to(1, { position: cc.v2(-200, 0)})
).start();
使用parallel
要把动作放到repeatForever 里面才会无限循环
cc.tween(this.node).repeatForever(
cc.tween()
.by(1, { x: 200})
.by(1, { x: -200})
).start();
这样就能达到你要的效果
你们不用union的吗