Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: sloppy on Tue 08/11/2005 23:03:14

Title: Limiting random walk area
Post by: sloppy on Tue 08/11/2005 23:03:14
I have a character walk ranomly in the background.  Here's how I've got it:
if (character[ORT].Moving==0) {
character[ORT].Walk(Random(245), Random(165),eNoBlock);

My question is I want the character to walk on only a certain part of the walkable area.  Not too high up on the screen, and not too far to the right of the screen.  Is there a way to make that happen?
Title: Re: Limiting random walk area
Post by: Ashen on Tue 08/11/2005 23:16:22
Just alter the limits for the random numbers. E.g Random(115) + 50 for the y coord will mean they'll never go higher than y = 50, and Random(160) for the x coord will keep them on the left of the screen.