Turn-based Enemy Follow

Hey, wanted to start off by saying thank you Aron for the awesome pathfinding tools!

I am working on a turn-based game and I’ve hit a snag with some of the pathfinding using your A* project. The graph is a point graph and I created it using specified empty objects for a “game board”. I have a main player with AIPath and seeker.

I added this to AIPath:

bool leftMouseDown = false;

public virtual void Update () {

	if (Input.GetMouseButtonDown (0)) {
		leftMouseDown = true;

	if (!canMove) { return; }
	Vector3 dir = CalculateVelocity (GetFeetPosition());
	//Rotate towards targetDirection (filled in by CalculateVelocity)
	RotateTowards (targetDirection);

	if (navController != null) {
	} else if (controller != null) {
		controller.SimpleMove (dir);
	} else if (rigid != null) {
		rigid.AddForce (dir);
	} else {
		transform.Translate (dir*Time.deltaTime, Space.World);


public virtual void FixedUpdate () {
	if (leftMouseDown) {

		GameObject ship = GameObject.FindGameObjectWithTag("Player");
		RaycastHit hit;

		Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
		if (Physics.Raycast (ray, out hit)) {
			GameObject go = GameObject.Find(hit.transform.gameObject.name);

			if (Mathf.Floor(Vector3.Distance(ship.transform.position, go.transform.position)) <= 3) {

				target = go.transform;


			leftMouseDown = false;



This allows for the player to go to the specific game-board tile(node) based on the graph (node by node) depending on which tile(node) you clicked.

I’ve added an enemy AI to follow the main player but I cant seem to figure out how to restrict the enemy AI to one tile at a time. The enemy AIPath is a different script but it is basically the same as the one for player except its target variable is always set to the player’s position.

Here’s a sample of the game: chriswahlfeldt.com/web-game.html

I plan on adding a turn counter in the future to figure out who’s turn it is but I need to be able to restrict movement first.

How could I go about restricting the enemy to just one tile(Node) at a time while also “following” the main player?



If it should move in discrete steps, I don’t think you should use the AIPath script.
Take a look at the get started tutorial, it covers making a custom movement script: http://arongranberg.com/astar/docs/getstarted.php