Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Rik_Vargard on Sat 06/08/2022 12:05:51

Title: [SOLVED] Only "Walk Up" animation showing in any walk direction
Post by: Rik_Vargard on Sat 06/08/2022 12:05:51
Hello,

Well this never happened before.

- I created a new character NPC01
- I created the views etc.

NPC01 has to appear in the Room, then walk to the right and then FaceDirectionUp
But then this happens:



As you can see he's walking to the right but it's the Walk Up animation that's been used for some reason.
Here's the code; I even tried to force the Walk Right animation with cNPC01.Animate
Also, same thing happens when I make him walk to the left.

Code (ags) Select


function room_Load()
{
cNPC01.ChangeRoom (6, 36, 868, eDirectionRight);
}

function room_AfterFadeIn()
{
  cNPC01.FaceDirection (eDirectionRight);
  //cNPC01.Animate (2, 5, eRepeat, eNoBlock, eForwards);
  cNPC01.Walk (1205, 959);
  //Wait(1);
  cNPC01.FaceDirection (eDirectionUp);
}



Any ideas?


Title: Re: Only "Walk Up" animation showing in any walk direction
Post by: Rik_Vargard on Sat 06/08/2022 16:56:32
Hah I finally discovered that the problem only happens in that room!

Because of this:

Code (ags) Select
function room_AfterFadeIn()
{
  player.SetWalkSpeed (25, 15);
  oArtPNG.Animate(0, 5, eRepeat, eNoBlock, eForwards);
 
  cNPC01.Walk (1913, 970, eNoBlock, eWalkableAreas);
  Wait(1);
  //cNPC01.FaceDirection (eDirectionUp);
  Wait(1);
}


The FaceDirection happens from the beginning and not after he's done walking.

NOW the question is :

How can I have him turn AFTER he's done walking, and then turn him again and have him walking back?

All "in the background"

Cheers

Title: Re: Only "Walk Up" animation showing in any walk direction
Post by: Pax Animo on Sat 06/08/2022 17:20:38
 cNPC01.Walk (1205, 959);
  //Wait(1);
cNPC01.FaceDirection (eDirectionUp);

With a no blocking walk, the cNP01 direction faces up? as the face direction line is executed right after the walk line.

Maybe this?
Title: Re: Only "Walk Up" animation showing in any walk direction
Post by: Rik_Vargard on Sat 06/08/2022 17:27:11
Quote from: Pax Animo on Sat 06/08/2022 17:20:38
cNPC01.Walk (1205, 959);
  //Wait(1);
cNPC01.FaceDirection (eDirectionUp);

With a no blocking walk, the cNP01 direction faces up? as the face direction line is executed right after the walk line.

Maybe this?


Haha funny timing....  thanks a lot for the answer Pax Animo!!  (nod) Yes I found that out at last! :)

So now, how can I do this:

How can I have him turn AFTER he's done walking, and then turn him again and have him walking back?

All "in the background"
Title: Re: Only "Walk Up" animation showing in any walk direction
Post by: Pax Animo on Sat 06/08/2022 17:53:37
There are more than a few ways to achieve this depending on intended use.

You could simply use a region which when the character walks onto directs the character to new coordinates. little code involved

There's also Character.AddWaypoint

https://adventuregamestudio.github.io/ags-manual/Character.html#characteraddwaypoint
Title: Re: Only "Walk Up" animation showing in any walk direction
Post by: Rik_Vargard on Sun 07/08/2022 13:11:52
Aye aye thank you very much, I can now move my NPC in the background!

Cheers! :)