I am making a game with enermies who when they are closer than a certain dinstance walks agains you.
The first problem is that when your character is outside their range they just stand still. I want them to walk around aimlessly instead of just, yes, standing still.
The other problem is that when they moves towards you they either walks on each other so they in the end just are a big pile of enermies which dies at the same time or if I use "movement stop" they locks each other in a big unmoving clod.
If you understands my confunsing explanation and have the knowledge to solve my problems, it would be very appreciated if you can help me
Try with these...
set enemies value A to a random number like 0-5 every 1 sec, and add a condition to every value.
value A = 1 = stop
value A = 2 = look in random direction + start +speed
and so on....
U can also use a counter object, but then it will affect every enemy at once..
I use bouncing ball movment for enemies, works best for me. Enemies will behave more realistic when they randomly move and stop and looking around.
For the "big pile" problem I use a invisble circle attached to the enemy that is slight bigger then the character, and make it bounce with eachouther and the background instead of the character bouncing around.
If these sounds to hard I can give u a more detailed description.
For each enemy, create a 'TARGET' object. Every 3 seconds (or more), set the position of every TARGET to a random spot on the level. All enemies who are not in range of the player will look at the target objects and walk towards them. If they touch the target before it's moved away, they stop and wait.