-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include diagonal tiles in the surrounding tiles as an optional parameter #3973
Comments
As stated on the related PR, I am not strictly again adding the feature but I'd would prefer to have it backed by a real-life use case. I mostly implemented this function as a helper to deal with the bucket fill tool, for which getting diagonals tiles are not useful. But yeah, if someone use it for something else I am not against adding this parameter, it would make sense. |
Hello, unsure if this is the correct place, but I have a use-case in a game I'm making @groud I'd like to get all tiles (including diagonals) around a point, which represents all valid adjacent tiles to a target in a game-word where diagonal movement is possible. Would really like this feature, thank you. If it helps, I assumed including diagonals was the default behavior of this function before I looked into it. |
I was trying to do this for an easier way to define auto tiles I should update to fix the bitmask.
I will now have to make a nested for loop to iterate through the diagonals aswell |
I believe I have a use case for this. Or maybe I just don't know the right way of doing what I want. In my game, you can place an action on top of a cell, such as "Mine". Once that's done, you can right-click on a unit and then right-click on the cell and order it to perform the action.
My goal is to, if the user right-clicks on the action 1 in the grid shown above, it automatically executes the actions on positions 2 and 3 in a sequence. If GetSurroundCells would return the cells on all 8 directions, this would be very easy to achieve. |
I also have a use case for this. I am attempting to get all the surrounding tiles (including diagonals) to update my cells using Having an optional parameter to check for diagonals with My current solution is the following: func get_neighbor_cells(_position: Vector2i) -> Array:
# Get the neighboring cell positions of cell at _x, _y
var neighbor_cells: Array
for x in range(-1, 2):
for y in range(-1, 2):
if x == 0 and y == 0:
continue
var nx = _position.x + x
var ny = _position.y + y
neighbor_cells.append(Vector2i(nx, ny))
return neighbor_cells |
I'm working on a multiplayer top-down game where I have a single spawn point at the start of the level. It seems like it might be possible to do this more arduously using |
Describe the project you are working on
I play with tilemaps, procedural generation and test out the new features of 4.0 Alpha
Describe the problem or limitation you are having in your project
On TileMaps the call
get_surrounding_tiles
will only return the left, top, right and bottom cells. When using with a grid I would expect also the diagonal tiles to be included in this request. I would like to introduce an optional parameter that also allows the selection of the diagonal parameters.Describe the feature / enhancement and how it helps to overcome the problem or limitation
It will remove the need to iterate over the tiles manually. Similar to the
get_surrounding_tiles()
method, which is already a wrapper over theget_neighbor_cell()
method.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
draft: godotengine/godot#58140
If this enhancement will not be used often, can it be worked around with a few lines of script?
Yes it can be. Similar to the current
get_surrounding_tiles
method which usesget_neighbor_cell
internally as well.Is there a reason why this should be core and not an add-on in the asset library?
Because it would complete an existing method.
The text was updated successfully, but these errors were encountered: