oioiya 0 Newbie Poster

I'm trying to make a game (I'm new at this), what I want is to catch an object and then use that object as a bullet to shoot an enemy, but I don't know how to do that, here's a bit of the code I'm using: Any tips??

//FLORES, this are the objects that fall and that I want to catch use as bullets

function criaFlor() {

    var divFlor = document.createElement('div');

    divFlor.id = "flor";


    divFlor.size = 24;
    divFlor.currentX = Math.random() * gameDiv.width; 
    divFlor.currentY = gameDiv.top;
    divFlor.speedX = 0; 
    divFlor.speedY = 2;


    flores.push(divFlor);

    gameDiv.appendChild(divFlor);


    setTimeout(criaFlor, Math.round(Math.random() * 1000));
}

    function atiraFlor() {

    var lixoFlores = new Array();


    for (var i=0; i<flores.length; i++) {

        flores[i].currentX += flores[i].speedX;
        flores[i].currentY += flores[i].speedY;


        flores[i].style.left = flores[i].currentX + "pt";
        flores[i].style.top = flores[i].currentY + "pt";


        if (flores[i].currentY > gameDiv.height) {

            lixoFlores.push(flores[i]);
            floresPassed++;
        }
    }

    removeItems(lixoFlores, flores, gameDiv);       
}


    function colisaoflores(f1, f2) {

    if ((f1.currentX > f2.currentX + f2.size - 1) || 
        (f1.currentY > f2.currentY + f2.size - 1) || 
        (f2.currentX > f1.currentX + f1.size - 1) || 
        (f2.currentY > f1.currentY + f1.size - 1))   
    {

        return false;
    }


    return true;    
}


//Here's where i don't know what to do, I mean, I know i have to use a conter and an if that says if the counter is bigger than 0 then the hero can shoot, but I'm stuck on how to do it

function apanhaflores() {

    for (var f=0; f<flores.length; f++) {
        if (colisaoflores(ship, flores[f]) == true) {

        }               
    }           
}