bullets in actionscript

Miscellaneous Forums/General Discussion/bullets in actionscript

hi all,
im trying to make a game in flash. i need some help with bullets. i need to know how to check each individual bullet to see if it is off the screen or colliding with an enemy so that i can delete it. i also need help in moving the bullets. i think i need something like blitz's for...next loop so i can iterate through all the instances of an object in the library. any help to accomplish these things would be very appreciated.
thanx in advance

I've not exactly done a lot of actionscript, but I guess you'd need to store each bullet object in an array, and then cycle through the array with something like:

for (i=0;i<bulletArray.length;i++){
// And then check each item's co-ords in here, (bulletArray[i]._xpos and bulletArray[i]._ypos)
}

To be honest, an ActionScript forum might be a better bet.

thnx, i have another question though.
what if i wanted to check all the instances of an object that havent been created through code. example: say i have 10 instances of a library object on the stage and i wanted to put a event listener on all of them. how would i do that?

Write a class that is associated with the library item; then in the constructor of that class, assign a listener to the new object.

can u tell me how to work with custom classes. i think i understand how to write them but i dont understand how to import them into my fla file. can you tell me if this is write as far as the code:

package{

class myClass{

//methods and properties.

}


}



You might have more luck, as Glenny-boy said, asking these kinds of questions on a Flash/ActionScript forum.
Or get yourself a good ActionScript book. There are many.