# how do i make this constant /infinite Hope u help me as i know all of u r geniuses in prog

Updated on June 2, 2018 in
2 on June 2, 2018

## Ameen–Today at 00:43

can Iget some help plz

using System.Collections; using System.Collections.Generic; using UnityEngine; public class Moving_Enemy : MonoBehaviour { public int currentNode; public Transform[] path; public bool rotateTowardsCurve; void Update() { Move(8 *Time.deltaTime); } void Move(float dist_to_travel) { //check of the distance is 0 or less, that shouldnt do anything if (dist_to_travel <= 0) return; //please no index out of bounds if (currentNode == path.Length – 1) return; //distance from current point to the next node var nextNodeDist = Vector3.Distance(transform.position, path[currentNode + 1].position); //rotate if needed if (rotateTowardsCurve) { transform.rotation = Quaternion.LookRotation(Vector3.forward, (path[currentNode + 1].position – transform.position).normalized); } //if the distance we travel on this frame is equal or greater than the distance to the next node do this if (dist_to_travel >= nextNodeDist) { //increase node score currentNode++; //go to next node transform.position = path[currentNode].position ; //move with the remaining distance we can travel on this frame. Move(dist_to_travel – nextNodeDist); } else { //if not, just travel towards the next node we can go to. transform.position = Vector3.MoveTowards(transform.position, path[currentNode + 1].position, dist_to_travel); } } }

how do i make it constant
• Liked by
on June 2, 2018

plz as I KNOW ALL OF UR PROGRAMMING GENIUSES.

• Liked by