Unity Ai Tutorial

Does anyone know of a good tutorial that could show me how to make a health bar, make an enemy which could cause damage until the player dies and then have a re spawn button?

here is a tutorial but it is very long.

For the AI to make something follow you, you want to use something like this script I wrote:

function Update() {
	    enemy.transform.LookAt(target);
		enemy.transform.position = Vector3.Lerp(
		enemy.position, target.position,
		Time.deltaTime * moveSpeed);
}

Then you want to use the variables:

var target : Transform;
var enemy : Transform;
var moveSpeed : float = 5.0;

You can select the items as the target and the enemy (which chances are is the gameobject the script is attached to) in the unity Inspector view under the script options. The complete script should look something like this:

var target : Transform;
var enemy : Transform;
var moveSpeed : float = 5.0;

function Update() {
	    enemy.transform.LookAt(target);
		enemy.transform.position = Vector3.Lerp(
		enemy.position, target.position,
		Time.deltaTime * moveSpeed);
}

PS: If you don’t understand what i’m talking about you should start with something easier.

Also learn about Vector3s and Vector3.Lerp. You can read up about Vector3’s HERE and Vector3.Lerp HERE.