How would I make my Non Player Character walk back and forth between 2 points? And if my player character collides with him, how would I make the game end?
You would have to do something like the following. The comments are self-explanatory. Consult the manual for more detail, give it a try, and let us know how it works out. ;)
int NpcX[2];
int NpcY[2];
int NpcPos;
function RepExec() {
// Wait for Npc to stop moving
if (!cNpc.Moving) {
// Set the index for the next position
if (NpcPos==0) NpcPos = 1;
else NpcPos = 0;
// Move NPC to the next position
cNpc.Move(NpcX[NpcPos], NpcY[NpcPos], eNoBlock);
}
// NPC is moving so check for collision
else {
if (cNpc.IsCollidingWithChar(player) {
// Characters are colliding so do something
}
}
}