Get Index of Property That Holds An Object In An Array
I have 3 arrays, structured so that one holds the frame label for the animation, and the other two hold the high and low values for the random damage calculator(which is working fine). There is a property called curAnim which gets set in a function to a random index in itself (a string, because it's a frame label). I need to be able to set a property that will hold the correct damage values to an index of the high and low damage arrays that is the same index of the frame label. Here is some code:
switch(curType)
{
case 'atk':
curAnim = attackList[randomCalc(0, attackList.length)];
if(curAnim == null)
{
gotoAndPlay('punch');
curTarget.damage(atkDamL[curAnim], atkDamH[curAnim]); // here I try to send the high and low damage values to the enemy target (and the damage function works fine)
returnMe();
}
else
{
gotoAndPlay(curAnim);
curTarget.damage(atkDamL[curAnim], atkDamH[curAnim]);
//returnMe();
}
break;