import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

const OUTMOVE = -10;

@ccclass('zd')
export class zd extends Component {

    @property
    public z_speed:number = 0;

    start() {

    }

    update(deltaTime: number) {
        const pos = this.node.position;
        const moveLength = pos.z - this.z_speed;
        this.node.setPosition(pos.x, pos.y, moveLength);

        if(moveLength < OUTMOVE){
            this.node.destroy();
        }

    }

}

