# How to Make Fire Emblem Like Movement

Hello, I’m currently taking the course: Unity Turn Based Strategy: Intermediate C# Coding. I love games like XCOM and Fire Emblem and was wondering how to make the movement in this course more like Fire Emblem where the max range is the X and Y axis when viewed from a top-down perspective and going diagonal would require using another movement.

I don’t know Fire Emblem but had a look at some gameplay videos. I’m not 100% sure what you mean because the characters move diagonal in the videos I’ve seen.

A simple way to not have diagonal movement is to not return the diagonal neighbours in the `Pathfinding` script. (I’ve commented out the diagonal neighbours bits)

``````private List<PathNode> GetNeighbourList(PathNode currentNode)
{
List<PathNode> neighbourList = new List<PathNode>();

GridPosition gridPosition = currentNode.GetGridPosition();

if (gridPosition.x - 1 >= 0)
{
// Left
neighbourList.Add(GetNode(gridPosition.x - 1, gridPosition.z + 0));
//        if (gridPosition.z - 1 >= 0)
//        {
//            // Left Down
//            neighbourList.Add(GetNode(gridPosition.x - 1, gridPosition.z - 1));
//        }
//
//        if (gridPosition.z + 1 < gridSystem.GetHeight())
//        {
//            // Left Up
//            neighbourList.Add(GetNode(gridPosition.x - 1, gridPosition.z + 1));
//        }
}

if (gridPosition.x + 1 < gridSystem.GetWidth())
{
// Right
neighbourList.Add(GetNode(gridPosition.x + 1, gridPosition.z + 0));
//        if (gridPosition.z - 1 >= 0)
//        {
//            // Right Down
//            neighbourList.Add(GetNode(gridPosition.x + 1, gridPosition.z - 1));
//        }
//        if (gridPosition.z + 1 < gridSystem.GetHeight())
//        {
//            // Right Up
//            neighbourList.Add(GetNode(gridPosition.x + 1, gridPosition.z + 1));
//        }
}

if (gridPosition.z - 1 >= 0)
{
// Down
neighbourList.Add(GetNode(gridPosition.x + 0, gridPosition.z - 1));
}
if (gridPosition.z + 1 < gridSystem.GetHeight())
{
// Up
neighbourList.Add(GetNode(gridPosition.x + 0, gridPosition.z + 1));
}

return neighbourList;
}
``````
1 Like

Sorry about that I’m rather new to all this, but in the lecture they can move diagonally with no penalty, while moving diagonally, the unit would not be able to travel as far. The movement in the lecture mostly resembles XCOM where movement diagonally isn’t affected too much and Fire Emblem has units that can travel a certain amount of distance but travel a shorter distance when moving diagonally.

I see. So, currently we can move, say, 10 cells on x or 10 cells on y but also 10 cells on the diagonal. You want it to be the same distance as moving 5 on x and then 5 on y (for a total of 10) which would result in a diagonal movement of only 5 cells.

The code I shared above would do that because the unit will ‘zig-zag’ to move diagonal meaning it needs to move 2 cells (1 horizontal and 1 vertical) to move 1 diagonal cell. The problem with the course’s movement is that we do not restrict movement to number of cells, but to an area within range. Even with the ‘zig-zag’ it will still cover 10 diagonal cells.

In the course, we determine the valid action positions as a square. You could change this to a diamond shape instead. This would then give you full distance on x or y, but restricted distance on the diagonals. The closer the movement is to 45°, the less movement will be allowed.

This is with a max distance of 4

I’m trying to figure out a simple way the list could be constructed to achieve this shape.

1 Like

Thank you, I haven’t finished the course yet, but will test this out once I reach the Pathfinding segment.