// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const { ccclass, property } = cc._decorator;

@ccclass
export default class cloundmove extends cc.Component {


    @property
    toLeft: boolean = true;

    // LIFE-CYCLE CALLBACKS:

    onLoad() {
        if (this.toLeft) {
            cc.tween(this.node).by(300 + Math.random() * 100, { x: -2000 }).start();
        } else {
            cc.tween(this.node).by(300 + Math.random() * 100, { x: 2000 }).start();
        }
    }
}
