Whats the formula to generate these coords with Isometric Diamond Right Tiles

Godot Version

v4.2.2.stable.official [15073afe3]

Story

Hi! Recently I’ve been developing a game with Isometric perspective and Tile-based movement, so far I have been using default Stacked layout and today I found the need to switch to Diamond Right one to better calculate how much energy player wasted on his move.
With this new layout my old formula for generating possible player movements doesnt work anymore, it was a basic double For loop and it produced a nice rectangular-like shape that perfectly fit the tiles’ orientation, now this formula produces Diamond shape that is not suitable for me

Shape needed
image

Shape produced with old formula

Needed coordinates are:
[(0, -3), (1, -2), (2, -1), (3, 0), (0, -2), (1, -1), (2, 0), (-1, -2), (0, -1), (1, 0), (2, 1), (-1, -1), (1, 1), (-2, -1), (-1, 0), (0, 1), (1, 2), (-2, 0), (-1, 1), (0, 2), (-3, 0), (-2, 1), (-1, 2), (0, 3)]

And coordinates produced by old formula are:
[(-3, -3), (-3, -2), (-3, -1), (-3, 0), (-3, 1), (-3, 2), (-3, 3), (-2, -3), (-2, -2), (-2, -1), (-2, 0), (-2, 1), (-2, 2), (-2, 3), (-1, -3), (-1, -2), (-1, -1), (-1, 0), (-1, 1), (-1, 2), (-1, 3), (0, -3), (0, -2), (0, -1), (0, 0), (0, 1), (0, 2), (0, 3), (1, -3), (1, -2), (1, -1), (1, 0), (1, 1), (1, 2), (1, 3), (2, -3), (2, -2), (2, -1), (2, 0), (2, 1), (2, 2), (2, 3), (3, -3), (3, -2), (3, -1), (3, 0), (3, 1), (3, 2), (3, 3)]

Question

Is there any way to produce Square-like shapes on Diamond Right layout using some formula?
(Only other way I see this working is manually adding all the coordinates for needed tiles to an array of movement options)

To produce the needed array of coordinates you can add a check to see if absolute x and absolute y coordinates add up to a number lower or equal to 3:

If abs(x) + abs(y) <= 3:
yourArrayhere.append(Vector2i(x,y)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.