Author Topic: animate a secondary character while the protagonist can be used  (Read 163 times)

Hello! I would need a secondary character to make an animation constantly (imagine two characters talking, but without text, only the animation) while the protagonist continues to act in the room.
I have tried with the following code:

Code: Adventure Game Studio
  1. function room_AfterFadeIn()
  2. {
  3. cJuan.LockView(34);
  4. cJuan.Animate(2, 5, 0, eNoBlock, eBackwards);
  5. Wait (70);
  6. cJuan.UnlockView();
  7. Wait (10);
  8. cPeter.LockView(42);
  9. cPeter.Animate(1, 5, 0, eNoBlock, eBackwards);
  10. Wait (70);
  11. cPeter.UnlockView();
  12. Wait (10);
  13. }

However, the protagonist can't move while the animation is in progress.

What would be the best way to get what I want? And how could I make the action repeat itself every X time?
« Last Edit: 13 Apr 2019, 14:27 by croquetasesina »


  • Cavefish
  • Fleeing the Cylon tyrrany...
    • Cassiebsg worked on one or more games that won an AGS Award!
    • Cassiebsg worked on one or more games that was nominated for an AGS Award!
Well, of course the protagonist can't move, since you telling the game to "wait", when you wait you are blocking.

If the action will have to be repeated every x times, then you'll need a timer.
Start the timer at room start, or after fadein, and in rep_exe check for if the timer has expired, when expired set the animation in motion again.

To make the characters act in the BG, you need to start them moving (non-blocking) at room_start or afterfadein, and then check in rep_exe if they are animating, and if not, you just tell them to animate again. make sure you add repeate.

Also, why are you locking and unlocking the animation?

If you want them to keep repeating the actions, lock their view then "cJuan.Animate(2, 5, eRepeat , eNoBlock, eBackwards);"
Then in rep_exec, just check if (!cJuan.Animating) cJuan.Animate(2, 5, eRepeat , eNoBlock, eBackwards);

EDIT: Okay, technicaly you don't even need to start them animating at room_start or afterFadeIn... since the rep_exec will pick up and start the animation... so just do the rep_exe line and see if that solves your problems

« Last Edit: 13 Apr 2019, 14:42 by Cassiebsg »
There are those who believe that life here began out there...