Could someone help me code for a character (eg. BOY) to face character (EGO) but also play animation (idle animation or not) between?
I tried making several functions in repeatedly execute but none worked.
I managed to get BOY to keep facing EGO whereever he moves in the room, but when after awhile he stutters. I am guessing it is conflicting with his idle animation. I would like him to keep facing EGO but also play animation between a certain time ( The idle animations have their own facing too, but doesn't have to be idle animation) and after animation continue facing EGO.
Help would be much appreciated. :)
I think you're right, the repeated FaceCharacter commands are blocking the idle view from happening
I've tested this, so I'm fairly sure it works. Whether it's exactly what you want ...
First, in the 'Player enters room' interaction, create a timer:
SetTimer (1, GetGameSpeed()*30);
Assuming you want 30 seconds between animations - I think that's the default. If not, change GetGameSpeed()*30 to GetGameSpeed()*whatever.
Then, in rep_ex:
if (IsTimerExpired (1)==1) {
SetCharacterView (BOY, IDLEVIEW);
AnimateCharacter (BOY, character[BOY].loop, 3,0);
ReleaseCharacterView (BOY);
SetTimer (1, GetGameSpeed()*30);
}
else if (character[BOY].animating == 0) FaceCharacter (BOY, EGO); //i.e. won't run during idle anim
Changing IDLEVIEW the the number of the view you want to use, and GetGameSpeed()*30 if needed.
You release the character view right after calling the non-blocking animation so the idle view will never display. I guess you meant:
if (IsTimerExpired (1) == 1) {
SetCharacterView (BOY, IDLEVIEW);
AnimateCharacter (BOY, character[BOY].loop, 3, 0);
SetTimer (1, GetGameSpeed()*20);
}
else if (character[BOY].animating == 0) { // i.e. won't run during idle anim
ReleaseCharacterView (BOY);
FaceCharacter (BOY, EGO);
}
The default idle delay is 20 seconds.
Thanks alot Ashen and strazer. It works. Changing where ReleaseCharacterView was placed helped, because the animation stuttered like before.