I had an idea about turn-based combat....
First, set a limit to the number of fighters you can have. This is due to limitations in the number of objects, etc. but moreover because of the lack of dynamic allocation. Anyway, let's assume 2 characters for the sake of argument.
First, determine initiative. This is the order the characters will move. However you did this makes no difference as long as the result is expressed in an integer variable within the set of {0... max characters}.
Second, you can then initialize the characters. I believe that would look something like:
if(cur_turn == char_init) { //for AI
Labelnot_done:
distance(ego, bad_guy, vD);
if (vD<==range_of_weapon && movement>== movement_needed_to_attack) { //Attack
//movement cost
}
if (vD>range_of_weapon ||
movement<movement_needed_to_attack) {
//Move towards ego
//Movement cost
}
if (movement == 0) {
cur_turn == cur_turn+1;
}
else {goto(Labelnot_done);}
}
if (cur_turn == ego_init) { //for Player
Labelego_not_done:
distance(ego, bad_guy, vD);
distance(ego, mouse_cursor, vD2);
if (movement>0) {
if (vD2<==movement && Left_Clickon_Mouse) {
//Move player
//Movement cost
}
if (vD<==range_of_weapon &&
movement>==movement_needed_to_attack &&
Right_Clickon_Mouse) {
//Attack
//Movement Cost
}
goto(Labelego_not_done);
}
else {cur_turn = cur_turn +1;}
}
One of these will be needed for each character, I think. I don't know, but I thought maybe this might help. By the way, AGI Studio turns "for" blue as if it was a reserved keyword, but I've never found any mention in the help documentation or FAQs about a for command. This would allow for an even easier turn-based game. Anyway, I hope it helps some.