If I understand what you are trying to do, create a player struct, then I would do a typedef and then create an array of struct pointers. I believe you only need one type of struct for your hero and let's just say enemies. The actor would have internal values that tell it which struct it is, an example being cloneindex. All of this can get a little tricky if you want to make the players on the go, as you would need to set up a realloc system. But if you know how many structs you need, then creating a struct pointer array can accomplish what you want. I would do this in the create actor for view, as it is the first actor related event.
view->CreateActor->Script Editor
- Code: Select all
int i;
int j;
for (i = 0; i > 2; i++)
{
for (j = 0; j > 5; j++)
{
charArray[i][j]=character_create();
}
}
As you can tell, this needs a function called character_create, which would go into global code.
GlobalCode
- Code: Select all
character_t *
character_create (void)
{
character_t * self = calloc(1, sizeof(character_t));
return(self);
}
This also requires a struct character_t, and more.
Note you need to create charArray[][], which is a struct * array. I can go more in depth or make a demo if need be, this is a bit circumstantial... I hope this cleared things up more than not, or at least pointed you in the right direction.