I have just recently started coding and already ran into a problem. I want an enemy to chase the player, but by following what the player is doing. I want it to also increase the rate at which it follows the path that way it can actually catch the player. It doesn’t matter whether the code is in C# or Javascript. Thank you for your time and help.
var nextUsage;
var delay = 0;
var target : Transform;
private var thisTransform : Transform;
private var velocity : Vector2;
function Start()
{
nextUsage = Time.time + delay;
thisTransform = transform;
}
function Update()
{
if (Time.time > nextUsage)
{
nextUsage = Time.time + delay;
thisTransform.position.x = (target.position.x - 60/Time.time);
thisTransform.position.y = (target.position.y);
}
}