The problem you have here is that you're triggering the walk command and then immediately facing another direction and triggering the timer, so all these commands get run right one after the other. Like I said at first, you need to check if the timer is running, and if it's not, then start it. And you need to do things like facing a certain direction on arrival, not on departure, so to say.
Unfortunately,
as far as I know, AGS has no way to track if a timer is running, so we'll have to use a variable for that ("but what about IsTimerExpired?", you say. The problem with that is that IsTimerExpired only gets checked once, and then the timer is disabled, so it's not a real "is timer running" check). Put this at the top of your room script, outside any functions:
bool istimerruning = true;
Now set your first timer, like you did in your code:
function room_AfterFadeIn()
{
SetTimer(1, 200);
}
And now try this in
repeatedly_execute_always, not rep_Exec.
function repeatedly_execute_always()
{
if (!Man1.Moving) {
if (!istimerruning) {
if (cMan1.x == 564) {
cMan1.FaceDirection(eDirectionUp, eNoBlock);
SetTimer(1, 200);
}
if (cMan1.x == 418) {
cMan1.FaceCharacter(cFemale4, eNoBlock);
cFemale4.FaceCharacter(cMan1, eNoBlock);
SetTimer(1, 240);
}
if (cMan1.x == 563) {
cMan1.FaceDirection(eDirectionUp, eNoBlock);
SetTimer(1, 240);
}
if (cMan1.x == 327) {
cMan1.FaceDirection(eDirectionDown, eNoBlock);
SetTimer(1, 240);
}
istimerruning = true;
}
if (IsTimerExpired(1)){
if (cMan1.x == 327) cMan1.Walk(564, 372, eNoBlock, eWalkableAreas);
if (cMan1.x == 564) cMan1.Walk(418, 406, eNoBlock, eWalkableAreas);
if (cMan1.x == 418) cMan1.Walk(563, 372, eNoBlock, eWalkableAreas);
if (cMan1.x == 563) cMan1.Walk(327, 487, eNoBlock, eWalkableAreas);
istimerruning = false;
}
}
}
The logic here is:
- Is the character moving? If it is, do nothing.
- If not moving, is a timer running?
- If no timer is running, then it means we just got to our destination. In this case, face towards the appropriate direction and
now we start the timer and set
istimerrunning to true.
- Is the timer expired?
- If it's not, do nothing.
- If it is, set
istimerrunning to false and tell the character to move to the next spot.
Let me know if it works!