Whoa people! I've got a tough question (tough for me anyway) and I'm not even sure how to describe it, but I'll do my best. Any help is greatly appreciated.
*Background:* I'm making a turn-based game in which there could be any number of spaceships in the air at any given time. When each is launched, a destination is selected by the player and the ship heads towards its destination at a predetermined speed. Ships are supposed to continue to approach their destinations when the player presses the "next turn" button.
*The problem:* How can I get each airborne ship to call the function that contains the code to move?
*Things I've Already Tried:*
--I created an int variable called shipCount, which is used to keep track of how many ships exist at any given time. Then, I create pointers to each ship as it is created. Something like this:
Actor *ships[30]; //in global code
void createShip()
{
ships[shipCount] = CreateActor("ship", "default", etc. etc.);
shipCount++;
}
Then I created a nextTurn() function that looked more or less like this:
void nextTurn()
{
int i;
for(i = 0; i < shipCount; i++)
{
ships[i]->shipMove(); //this line wouldn't work
}
}
This wouldn't work. So the problem remained: how can I iterate through a group of actors and get each actor to call a function?
After this attempt failed, I thought it might just be a syntax problem so I replaced the function call with the actual code contained in the shipMove() function. While GE allowed me to do this, it didn't work when I ran the game (i.e., the ships didn't move). However, I know that the code itself is good because I can get it to work properly on a mousedown event.
I apologize for the complex post and question and am deeply grateful for anyone's insight.
Plinydogg