1
General / Re: How do i make enemy move by found shortest path?
« on: December 22, 2014, 02:25:38 pm »
Yeah, my english isn't that good to communicate so it's hard for me to ask good questions.
My main problem is/was that, i needed to have a position of each tile from bfs algorithm. In vertex array tutorials there is TileMap example it has "width" and "height" of array. When i have my path i need to get position of each tile, but i didn't have an idea how.
I am thinking about doing something like:
actuallTileNumber/width * tileSize.x = position.x and
actuallTileNumber/height * tileSize.y = position.y
then i just move sprite to the certain position, and get next tile.
I'm not really sure if it is correct and not sure if it would work, i can't test it now.
My main problem is/was that, i needed to have a position of each tile from bfs algorithm. In vertex array tutorials there is TileMap example it has "width" and "height" of array. When i have my path i need to get position of each tile, but i didn't have an idea how.
I am thinking about doing something like:
actuallTileNumber/width * tileSize.x = position.x and
actuallTileNumber/height * tileSize.y = position.y
then i just move sprite to the certain position, and get next tile.
I'm not really sure if it is correct and not sure if it would work, i can't test it now.