[SOLVED] Only "Walk Up" animation showing in any walk direction

Started by Rik_Vargard, Sat 06/08/2022 12:05:51

Previous topic - Next topic

Rik_Vargard

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


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?



Rik_Vargard

#1
Hah I finally discovered that the problem only happens in that room!

Because of this:

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


Pax Animo

 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?
Misunderstood

Rik_Vargard

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"

Pax Animo

#4
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
Misunderstood

Rik_Vargard

Aye aye thank you very much, I can now move my NPC in the background!

Cheers! :)

SMF spam blocked by CleanTalk