Yes, you just need to loop through your projectiles and check for collisions against the other object(s). Depending on how you're managing your projectiles, you might want to store them in an array. So each time you duplicate a movieClip to make a new projectile, add it to an array. For example:
ActionScript Code:
// array to hold references to your projectiles
var projectiles = new Array();
// create 10 projectiles
for(i=0;i<10;i++){
duplicateMovieClip(_root.projectile, "projectile" +i, i);
_root["projectile" + i]._x = _root.Char._x;
_root["projectile" + i]._y = _root.Char._y-200;
projectiles.push(_root["projectile" + i]);
}
// call this function (probably in an enterFrame) to check for collisions
// this assumes you are only checking for collisions again 1 object "ball"
function checkForCollisions():Boolean{
for(i=0;i<projectiles.length;i++){
if(ball.hitTest(projectiles[i]){
return true;
}
}
}
// if you have multiple objects to check against, you can use nested loops
var balls = new Array();
function checkForMultipleCollisions():Boolean{
for(i=0;i<projectiles.length;i++){
for(j=0;j<balls.length;j++){
if(balls[j].hitTest(projectiles[i]){
return true;
}
}
}
}
You might also want to look into using attachMovie instead of duplicateMovieClip. AttachMovie allows you to give library items linkage identifiers that can be used to pull items out of the library at runtime and attach them to the stage or another movieClip. This way you don't have to place items on the stage at author-time to duplicate at runtime. For example:
ActionScript Code:
// assume movieClip in library has linkageID of "projectile"
function createProjectile(clipToAttachProjectileTo,x,y):MovieClip{
var depth = clipToAttachProjectileTo.getNextHighestDepth();
var tempVar = clipToAttachProjectileTo("projectile","p"+depth,depth);
tempVar._x = x;
tempVar._y = y;
projectiles.push(tempVar);
return tempVar;
}