mirror of
https://github.com/ifengzp/cocos-awesome.git
synced 2024-12-25 11:19:16 +00:00
修复无限滚动问题
This commit is contained in:
parent
22fdbaaa18
commit
e07909e403
@ -8,6 +8,12 @@ export default class Infinite_bg_scroll extends cc.Component {
|
||||
bg2: cc.Node = null;
|
||||
|
||||
speed: number = 500;
|
||||
onLoad() {
|
||||
const viewSize = cc.view.getVisibleSize();
|
||||
this.bg2.getComponent(cc.Widget).left = viewSize.width
|
||||
this.bg2.getComponent(cc.Widget).right = -viewSize.width
|
||||
}
|
||||
|
||||
update(dt) {
|
||||
const temp = dt * this.speed;
|
||||
if (this.bg2.x - temp <= 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user