How to make a C# script that makes an enemyAI follow a player the way that Slenderman does?
I've being trying to make a c# script that randomly makes the enemyAI spawn near the player the same way that Slenderman does in the game. I've looked around but haven't been able to find anything. Any ideas? Attached is a script that I have been trying to create but hasn't worked.
using UnityEngine; using System.Collections;
public class FollowScript : MonoBehaviour { public Transform target; public Transform myTransform;
void update()
{
transform.LookAt(target);
transform.Translate(Vector3.forward * 5 * Time.deltaTime);
}
}
Change "update" to "Update" and it might work. However it will not give you the behavior of Slenderman.
To act like slender man it should jump close to you when you a) aren't looking and b) are moving away from it. For b) you could do check every update to get the distance between the player and the Slenderman, then if its over a certain distance.. $$anonymous$$ove Slenderman to be close to the player.
how would I go about doing that
Your answer
Follow this Question
Related Questions
Could someone translate these to c#? 1 Answer
HELP ! Highscore name input after each Death 0 Answers
Unity {[(2D)]} RotateAround while jumping 0 Answers
Why do I only have left/right mouse movement 1 Answer
2D Frogger Logs and Water issues 0 Answers