How can I make a non-player character repeatedly move all the way to the right and then to the left side of the screen? This should be happening in the background so the main character can interact with that NPC.
When I try to use something like
while (1)
{
MoveCharacterPath(NPC, 0, y);
MoveCharacterPath(NPC, 319, y);
}
the game crashes with an error message saying something like "path too complex, cannot add any more paths".
You see, the MoveCharacterPath() has a limit on a maximum number of linked paths.
I'd use room's repeatedly then: :P
function room_*() {
// script for room: Repeatedly execute
if (character[NCP].walking == 0) {
MoveCharacterPath(NPC, 0, character[NCP].y);
MoveCharacterPath(NPC, 319, character[NCP].y);
}
}