parent acting on child
Posted: Sat Dec 03, 2011 11:48 am
Hi you all, I have a little question. I have an actor caled enemy that creates another actor like this:
Create actor / script:
Then I set second actor's creator as his parent.
The thing is, I'd like to change second actor's animation from first one's variables.
something like this:
The script works perfectly But, Enemy actors are clones so I replaced the code this way:
But now it does not work anymore. Does someone know what to do to have one enemy actor act on his own second actor?
Thanks in advance
Create actor / script:
- Code: Select all
CreateActor("rabbit", "rabbit2_attack_right", "Creator Actor", "(none)", 0, 0, false);
Then I set second actor's creator as his parent.
The thing is, I'd like to change second actor's animation from first one's variables.
something like this:
- Code: Select all
switch(state)
{
case 0:
angle= direction(x, y, player.x, player.y);
directional_velocity=2;
switch(dir)
{
case 0:
ChangeAnimation("rabbit", "rabbit2_walk_left", NO_CHANGE);
break;
case 1:
ChangeAnimation("rabbit", "rabbit2_walk_right", NO_CHANGE);
break;
}
}
The script works perfectly But, Enemy actors are clones so I replaced the code this way:
- Code: Select all
ChangeAnimation("child", "rabbit2_walk_left", NO_CHANGE);
But now it does not work anymore. Does someone know what to do to have one enemy actor act on his own second actor?
Thanks in advance