Public feed #380589

Someone

public text v1 · immutable
Raw Edit
·published 2007-03-04 04:45 UTC
rendered paste body
//! Do AI
void DoAI() {

for(int i=0; i<50; i++) { // for every ally
 for(int x=0; x<50; x++) { // for every enemy
  if(allies[i]->getAbsolutePosition().getDistanceFrom(enemies[x]->getAbsoultePosition) < 10) 
   { // theyre in range   
    if(ally_states[i] == 1) // Attack
     allies[i].attack()
    if(ally_states[1] == 2) // Retreat
     allies[i].retreat()
   }
 }
}

for(int i=0; i<50; i++) { // for every enemy
 for(int x=0; x<50; x++) { // for every ally
  if(enemies[i]->getAbsolutePosition().getDistanceFrom(allies[x]->getAbsoultePosition) < 10) 
   { // theyre in range   
    if(ally_states[i] == 1) // Attack
     allies[i].attack()
    if(ally_states[1] == 2) // Retreat
     allies[i].retreat()
   }
 }
}

//! end
}