I think you could treat a bidimensional array(Or the same background) as a graph where each cell is a node and the relations are the adjacents cell. Then, you can use Breadth-First-Search to display the range of a unit(Movement or attack). You need to store the visited cell though... I think in two methods to do that: