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.
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?
Hah I finally discovered that the problem only happens in that room!
Because of this:
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
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?
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"
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
Aye aye thank you very much, I can now move my NPC in the background!
Cheers! :)