make enemies move and be killed if you're seen

Started by pro_designer, Sat 28/01/2006 21:17:09

Previous topic - Next topic

pro_designer

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?

ZZjZmoz

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.

Released Late August 2007

ZZjZmoz

That gives me a good idea. I'll make an enemy AI section in the Tutorials section of my website  ;D.

Released Late August 2007

pro_designer


SMF spam blocked by CleanTalk