I made a gravity runner game but I want the enemy to speed up in the beginning because he starts outside of the screen, any suggestions?
Here is my code:
using UnityEngine;
using System.Collections;
public class Enemy : MonoBehaviour {
public Transform target;
public int MoveSpeed = 8;
public int MaxDist = 2;
public int MinDist = 1;
private Zwaartekracht vijand;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
transform.LookAt(target);
if(Vector3.Distance(transform.position,target.position) >= MinDist && Zwaartekracht.state == 1){
transform.position += transform.forward * MoveSpeed * Time.deltaTime;
/*if(Vector3.Distance(transform.position,target.position) <= MaxDist)
{
//Here Call any function U want Like Shoot at here or something
} */
}
}
}
↧