Another, yes another problem. I’m just learning so I’m sure I’m making many stupid errors. How do you hitTest 2 separate arrays of different lengths, all entries against one another . Code below for guidance.
package{
import flash.display.*;
import flash.events.*;
public class ArrayCompare{
public var enemyArray:Array = new Array();
public var bulletArray:Array = new Array();
public function ArrayCompare(){
for(var i:int = 0; i<3; i++){ //this populates enemyArray
enemyArray.push*;
//create a child, place on stage stuff etc.
}
for(var i:int = 0; i<5; i++){ //this populates bulletArray
bulletArray.push*;
/create child, place moving on stage stuff etc.
}
addEventListener(Event.ENTER_FRAME, collision); //stage listener to test collision
}
public function collision(){ //needs to test entire array,
if(bulletArray*.hitTestObject(enemyArray*)){ //against entire array of
trace('hit!!!'); //different length
}
}
}
}