Skip to content
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

Iterating with AStar's get_available_point_id method #38263

Closed
almighty-atlas opened this issue Apr 27, 2020 · 0 comments · Fixed by #48958
Closed

Iterating with AStar's get_available_point_id method #38263

almighty-atlas opened this issue Apr 27, 2020 · 0 comments · Fixed by #48958

Comments

@almighty-atlas
Copy link

Godot version:
3.2

OS/device including version:
Windows 10 Pro 1909

Issue description:
When you try to iterate with the get_available_point_id method of the AStar class you get an index order of [1, 0, 2, 3, 4 ...] since the method returns 1 if empty.

Steps to reproduce:

  1. Make a Project with a Scene with a TileMap and create an 8x8 grid for example.
  2. Attach following script to it:
func _ready() -> void:
    var astar = AStar2D.new()
    var cells = get_used_cells()
    for cell in cells:
        astar.add_point(astar.get_available_point_id(), cell)
    print(astar.get_points())
  1. Output:
    [1, 0, 2, 3, 4, 5, ...]

Minimal reproduction project:
See 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants