Here is the basic situation. I want to set up a 2d grid format for a tactical RPG so I have a coordinate system. My intent is to input into a 2d 10x12 array that I have passing fine a position with in that array, for example player is located at 3,3. From there I take the movement range of the player, in this example 6 (the value will always be a number divisible by 2) and draw a diamond shape around the player based off that number.
Anyone who has played a tactical RPG is familiar with this system.
My trouble is coming in when trying to figure out the best way to build a temporary array that I am going to use to change the tiles textures to make it so the player can see this movement area.
I can set up an array just fine that has the right amount of length in the 1 position of the array.
For example:
for (int i = 0; i < moveDistance; i++)
{
tempArray*= new int[k]{?};*
}
This will obviously draw the array fine for the position.
What I need is for k to increase from 1 to my moveDistance-1 and back down to 1.
So my arrays would look something like:
tempArray[0] = [1] {yPosition};
tempArray[1] = [3] {(yPosition-1),yPosition,(yPosition+1)};
tempArray[2] = [5] {(yPosition-2),(yPosition-1),yPosition,(yPosition+1),(yPosition+2);
tempArray[3] = [3] {(yPosition-1),yPosition,(yPosition+1)};
tempArray[4] = [1] {yPosition};
For further detail if our player was sitting at position 3,3 my temp array would look like:
tempArray[0] = [1] {3};
tempArray[1] = [3] {2,3,4};
tempArray[2] = [5] {1,2,3,4,5};
tempArray[3] = [3] {2,3,4};
tempArray[4] = [1] {3};
I realize this will just return the Y coordinates for the movement. But it is a start for me.
Sorry for being so long winded. I can visualize and understand the logic behind how to do this I just don’t know how really to set up the conditional case where K will increase by K+2 until it reaches moveDistance-1 and then start going K-2.