Hi, well to start of with unity I reccommend starting with a very simple game for example a simple first person controller and an enemyAI, enemAI script (This is C#):
using UnityEngine;
using System.Collections;
public class EnemyAI : MonoBehaviour {
public Transform target;
public int moveSpeed;
public int rotationSpeed;
private Transform myTransform;
void Awake(){
myTransform = transform;
}
// Use this for initialization
void Start () {
GameObject go = GameObject.FindGameObjectWithTag(“Player”);
target = go.transform;
}
// Update is called once per frame
void Update () {
Debug.DrawLine(target.position, myTransform.position, Color.yellow);
//Look at target
myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed * Time.deltaTime);
//Move toward target
myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
}
}
this is a very simple enemy script where the enemy will follow the player (if the player is tagged player and if you’ve adjusted the speed and rotation on your enemy) maybe you could make a game where the cube has to push the player of an edge or something ( just add the script to a cube) You will need to add a box collider for it to work correctly. And then you could have a simple respawn script where when your player falls it respawns at the the start, this is an example respawn script (In Javascript):
function Update ()
{
if(transform.position.y <-20)
{
transform.position.x = 2;
transform.position.y = 2;
transform.position.z = 2;
transform.rotation.x = 0;
transform.rotation.y = 0;
transform.rotation.z = 0;
}
}
You will need to add that script to the player so when it falls it respawns, maybe you should add one to the cube as well in case it falls.
Anyway I hope this helped.