Actor array problem
Posted: Sun Jun 04, 2006 5:31 pm
Im trying to assign actors to an actor array, but the problem is that they are created by a shorter version of Create Actor function wich i made. It goes something like this:
It creates an actor by number insetad of name. Now in another function im trying to asign actors created by this function to an array. The other function goes like this:
When i try to add this i get a message "cannont convert from 'void' to '* struct' "
I we tried to do it with this
and it works perfectly! But i need to use the CreateEnemy function, so i can't do it that way.
I think that i need to redefine one of my functions but to what i don't know.
What am i doing wrong? I'we been busting my head about this for hours, someone please help
TIA
- Code: Select all
void createEnemy(int i, int x1, int y1)
{
switch(i)
{
case(1):
CreateActor("a", "anim1", "no parent", "no path", x1, y1, true);
break;
case(2):
CreateActor("a2", "anim1", "no parent", "no path", x1, y1, true);
break;
case(3):
CreateActor("a3", "anim1", "no parent", "no path", x1, y1, true);
break;
}
}
It creates an actor by number insetad of name. Now in another function im trying to asign actors created by this function to an array. The other function goes like this:
- Code: Select all
Actor *enemy[4];
void placeEnem(int en1, int en2, int en3, int en4)
{
if (en1!=0&&en2!=0&&en3!=0&&en4!=0)
{
enemy[1]=createEnemy(en1,view.x+40, view.y+50);
enemy[2]=createEnemy(en2,view.x+90, view.y+50);
enemy[3]=createEnemy(en3,view.x+150, view.y+50);
enemy[4]=createEnemy(en4,view.x+200, view.y+50);
}
When i try to add this i get a message "cannont convert from 'void' to '* struct' "
I we tried to do it with this
- Code: Select all
enemy[1]=CreateActor("a", "anim1", "no parent", "no path", view.x+90, view.y+50, true);
and it works perfectly! But i need to use the CreateEnemy function, so i can't do it that way.
I think that i need to redefine one of my functions but to what i don't know.
What am i doing wrong? I'we been busting my head about this for hours, someone please help
TIA