mirror of
https://github.com/ifengzp/cocos-awesome.git
synced 2024-12-26 03:39:22 +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;
|
bg2: cc.Node = null;
|
||||||
|
|
||||||
speed: number = 500;
|
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) {
|
update(dt) {
|
||||||
const temp = dt * this.speed;
|
const temp = dt * this.speed;
|
||||||
if (this.bg2.x - temp <= 0) {
|
if (this.bg2.x - temp <= 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user