thanks for the reply its working now "finaly

"
but the bullets arent appearing on the stage i think i know what the problem is but im not for sure im not good at the [i] things
i think the arrays make the problem.
Code:
function createBullet2():Void
{
for(var i = 0; i<enemyArray.length;i++){
//run this loop "bulletNumber2" amount of times
for(var p = 0; p < enemyArray[i].enemyWeapon.bulletNumber2; p++){
trace("oo");
//declare a temporary variable that we will use as a reference to the newly created bullet
///attach a movieclip from the library named bullet
var bullet2:MovieClip = _root.bulletcontainer2.attachMovie("bulletenemy", "b22"+_root.bulletcontainer2.getNextHighestDepth(), _root.bulletcontainer2.getNextHighestDepth());
//position bullet at the tip of the gun barrel (Thanks NoahJ!)
bullet2._x = enemyArray[i]._x + enemyWeapon.barrelLength2 * Math.cos(enemyArray[i]._rotation * radiansenemyx1);
bullet2._y = enemyArray[i]._y + enemyWeapon.barrelLength2 * Math.sin(enemyArray[i]._rotation * radiansenemyx1);
//calculate random bullet offset.
var randomNum2:Number = random(enemyArray[i].enemyWeapon.bulletOffset2)-(enemyArray[i].enemyWeapon.bulletOffset2/2);
//shooting towars target
bullet2._rotation = enemyArray[i]._rotation;
//set bullet firing angle
var bulletAngle2:Number = (enemyArray[i]._rotation + randomNum2) * radiansenemyx1;
//set bullet speed based on angle
bullet2.xSpeed2 = Math.cos(bulletAngle2) * enemyArray[i].enemyWeapon.bulletSpeed2;
bullet2.ySpeed2 = Math.sin(bulletAngle2) * enemyArray[i].enemyWeapon.bulletSpeed2;
//set a timer on the bullet
//when time runs out, run the playerWeapon2 function, passing bullet2 as an argument
//same as saying playerWeapon2(bullet2)
enemyArray[i].bullet2.lifeTimer2 = setInterval(destroyBullet2, enemyArray[i].enemyWeapon.bulletMaxAge2, bullet2);
//add bullet to bulletArray2 destroyBullet
bulletArray2.push(bullet2);
}
//start reloading gun
startReloading2();
}
}
at the top you see the first array with the enemys
and the secon with the bullets but that one has the enemyarray in it with an [i] but the array itself is [p]
i dont for sure if thats a problem..
and some other info here
Code:
//the container is on the stage[they shot before and i checked it :cool ]
var radiansenemyx1:Number = Math.PI/180;
//the bullet number is in the weapon object itself
var tempWeapon2:Object = {itemName2: "Pistol2",
bulletNumber2: 1,
bulletOffset2: 5,
bulletSpeed2: 30,
bulletMaxAge2: 400,
barrelLength2: 25,
reloadComplete2: true,
reloadSpeed2: 5000,
reloadTimer2: 0}
//now add the new weapon object to the weaponDatabase2 array
weaponDatabase2.push(tempWeapon2);
//and heres the bullet update function
function updateBullets2():Void
{
//run a loop on the bulletArray2
for(var i = 0; i < bulletArray2.length; i++)
{
//set a temporary variable that will store the current bullet from the array
var temporaryBullet2:MovieClip = bulletArray2[i];
//update temp bullet x & y based on its speed which we calculated during bullet creation
temporaryBullet2._x += temporaryBullet2.xSpeed2;
temporaryBullet2._y += temporaryBullet2.ySpeed2;
//check for collision
checkplayerHit(temporaryBullet2);
}
}
Hope you can help
Greetings
Reaven
