add an explosion were hitTest occured
hi
i am using AS3 and i have this hitTest occuring:
Code:
function hittest(e:Event):void {
for (var i=0; i<bulletArray.length; i++) {
if (rocketShip.hitTestObject(bulletArray[i])) {
trace("hit");
removeChild(bulletArray[i ]);
bulletArray.splice(i,1);
var fire:MovieClip = new explosion();
addChild(fire);
fire.x = rocketShip.x + 20;
fire.y = rocketShip.y - 5;
}
so at the moment an explosion called "fire" is added to the front of my ship when the hitTest = true, but sometimes my bullets don't hit the front, they might hit the side or back of my ship. so i would like my explosion to be added to wherever the hitTest occurred on the two objects.
thanks