Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

CAN SOMEONE PLEASE HELP ME WITH THIS ASAP!!!!!!!!!!

using UnityEngine;


public class Enemy : MonoBehaviour

{

  public float speed = 10f;


  private Transform target;

  private int wavepointIndex = 0;


  void start()

  {

    target = Waypoints.points[0];


  }

  void update()

  {

    Vector3 dir = target.position - transform.position;

    transform.Translate(dir.normalized * speed * Time.deltaTime, Space.World);


    if(Vector3.Distance(transform.position, target.position) <= 0.4f)

    {

      GetNextWaypoint();

    }

  }

  void GetNextWaypoint()

  {

    if(wavepointIndex >= wavepointIndex.points.Length - 1)

    {

      Destroy(gameObject);

      return;

    }

    wavepointIndex++;

    target = Waypoints.points[wavepointIndex];

  }

}


Assets\Enemy.cs(27,45): error CS1061: 'int' does not contain a definition for 'points' and no accessible extension method 'points' accepting a first argument of type 'int' could be found (are you missing a using directive or an assembly reference?)

Answers

  • Its because you used wavepointindex as an int variable and you are trying to access points array with a wrong name.

    As in the start method you used waypoint. Points

    And in the update

    You used wavepointindex.points

  • ABOABO Member

    If your problem has been solved, please mark your question as answered

Sign In or Register to comment.