problems with arrays
Posted: Fri Nov 26, 2010 4:29 am
I Have 4 enemies with different HP values. I need a code to destroy every actor with HP below 0. I want to use arrays. I really need to know how to use it. Should I create a variable with array option, or write
- Code: Select all
int HP[4];
- Code: Select all
HP[0]=80;
HP[1]=120;
HP[2]=60;
HP[3]=40;
- Code: Select all
int i
for(i=0;i<4;i++)
{
if(HP[i]<0)
{
DestroyActor("enemy.i");
}
}