I want my character to look either left or right, but not up and down. If he walks up or down he's supposed to subsequently face the direction he faced before walking. So loop 0 and 3 are only for walking, not for standing.
I really don't know how to solve that problem but it's perhaps because I'm not really concentrated right now.
If it matters: I use the keyboardmovement-module (that comes with AGS) and disabled the cursor.
Create a second view and put the existing walk cycle sprites for left and right in there.
Then change the first view's up and down sprites to the left sprites (LEFTVIEW), the second view's up and down sprites to the right sprites (RIGHTVIEW).
In rep_ex, add:
if (!player.Moving) {
if (player.Loop == 1 && player.NormalView != LEFTVIEW) player.ChangeView(LEFTVIEW);
if (player.Loop == 2 && player.NormalView != RIGHTVIEW) player.ChangeView(RIGHTVIEW);
}
The constant switching of views should be unnoticeable and shouldn't interfere with walking.
Thanks, that almost works perfectly.
There are just two small things:
1. If the character looks to the left and then goes down he briefly looks right before walking
And the exact opposite:
2. If the character looks to the right and then goes up he briefly looks left before walking
EDIT: Well, I'm almost certain this has to do with other lines of the script. I'll look into it and post the code if I'm not able to get rid of that small problem.
Did you turn off "Characters turn before walking?"
Ah, thanks, that did the trick.