How to enable character animation between repeated character facing?[SOLVED]

Started by ZayanM, Fri 25/02/2005 02:01:07

Previous topic - Next topic

ZayanM

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.  :)

Ashen

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:
Code: ags

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:
Code: ags

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.
I know what you're thinking ... Don't think that.

strazer

You release the character view right after calling the non-blocking animation so the idle view will never display. I guess you meant:

Code: ags

  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.

ZayanM

Thanks alot Ashen and strazer. It works. Changing where ReleaseCharacterView was placed helped, because the animation stuttered like before.

SMF spam blocked by CleanTalk