Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: pro_designer on Sat 28/01/2006 21:17:09

Title: make enemies move and be killed if you're seen
Post by: pro_designer on Sat 28/01/2006 21:17:09
This is complicated so bare with me.
I'm making a stealth base game where you have to sneek up on enemies and kill them when there backs are turned.I want the enemy to move tho,Any ideas?
Title: Re: make enemies move and be killed if you're seen
Post by: ZZjZmoz on Sat 28/01/2006 21:44:57
It's not all that hard to get a foe to move. There are a lot of ways to make a foe move around. Two good ones are:

1) If you want them to move everywhere...

You can set up a random variable called FoeWalkDirection or something of that sort. The FoeWalkDirection is assigned a direction in which the Foe will attempt to go. It should be randomized. Set a timer so that every so often (ie. 3 seconds, or even a random amount of time), or if a foe hits a wall, he/she will randomly change direction again.

2) If you want them to follow a route...

Just set up a number of paths using Character.AddWaypoint (int x, int y). The foe should follow this path during normal execution.

Of course, you're going to have to make sure to set up vars for SpottedPlayer or OnRedAlert and have them checked before going into the movement cycle, or else the foes will never go after you and will keep to their original paths.
Title: Re: make enemies move and be killed if you're seen
Post by: ZZjZmoz on Sat 28/01/2006 21:45:55
That gives me a good idea. I'll make an enemy AI section in the Tutorials section of my website  ;D.
Title: Re: make enemies move and be killed if you're seen
Post by: pro_designer on Sat 28/01/2006 22:00:27
yeah i meant you to get that idea ;)