Limiting random walk area

Started by sloppy, Tue 08/11/2005 23:03:14

Previous topic - Next topic

sloppy

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?

Ashen

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.
I know what you're thinking ... Don't think that.

SMF spam blocked by CleanTalk