J
Jonatherin
Guest
I'm creating a RTS Sci-fi game and I've run into a little problem.
I've been working on the enemy AI and I need a variable that is set to 1(true) when the enemies enemy(the player) has a fighter ship in the range of one of the enemy ships, and its set to 0(false) when there are no playerfighterships in the range of any(all) of the enemyships. Here's the code I made but simplified, ENEMY_SHIP-STEP_EVENT if (player_fighter_ship in range) {player_attacking=1;} else {player_attacking=0;} Obviously this causes a problem cause even if one enemyship is in the range of a playerfightership, another enemyship could not be in the range of a playerfightership and both enemyships will conctradict each other and the player_attack variable wont work right.
Sorry if this is confusing. I'm not that good at making forums or explaining things.
I've been working on the enemy AI and I need a variable that is set to 1(true) when the enemies enemy(the player) has a fighter ship in the range of one of the enemy ships, and its set to 0(false) when there are no playerfighterships in the range of any(all) of the enemyships. Here's the code I made but simplified, ENEMY_SHIP-STEP_EVENT if (player_fighter_ship in range) {player_attacking=1;} else {player_attacking=0;} Obviously this causes a problem cause even if one enemyship is in the range of a playerfightership, another enemyship could not be in the range of a playerfightership and both enemyships will conctradict each other and the player_attack variable wont work right.
Sorry if this is confusing. I'm not that good at making forums or explaining things.