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


const OUTOFRANGE = 50

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

    @property 
    public bulletSpeed = 0;


    start() {

    }

    update(deltaTime: number) {
        const pos = this.node.position;
        const moveLength = pos.x + this.bulletSpeed;
        this.node.setPosition(moveLength, pos.y, pos.z)
        if(moveLength > OUTOFRANGE){
            this.node.destroy()
            
        }
        
    }
}


