import { getTexture } from "./utils"


export class Bullets extends engine.Container{

    constructor(){
        super()
    }

    bullet:engine.Sprite 
    public bullets:engine.Sprite[] = []
    
    
    addBullet(planeModel?){
        let bullet = new engine.Sprite(getTexture('18852543-1f1d-498b-af64-88cd3b343758'))

        bullet.x = planeModel ? planeModel.x + planeModel.width / 2 - bullet.width / 2 : 375 - bullet.width / 2 ;
        bullet.y = 1150

        // this.bullets.push(bullet)
        return bullet
    }


    // public bulletMove(planeModel){
    //     let bullets:engine.Sprite[] = []
    //     let bullet = new engine.Sprite(getTexture('18852543-1f1d-498b-af64-88cd3b343758'));
    //     let centerX = planeModel.x / 2;

    //     bullet.x = planeModel.x && planeModel.x + centerX - bullet.width / 2  || 375 - bullet.width / 2 ;
    //     bullet.y = 1150
        
    //     bullet.y = bullet.y - 40;
        
    //     bullets.push(bullet)
    //     // return bullet
    //     return bullets
    // }


    public bulletMove(bullets){
        // setInterval(()=>{
            for(let bullet of bullets){
                bullet.y -= 40;
            }
        // },16)
    }
    
    

} 