Grid map logic

Updated on April 16, 2018 in Tutorial Ideas
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
1 on April 16, 2018

Hello, forum this is my first post and I have a logic problem
I would like make a grid map in unity and I would like to move my character with the raycast so now there it is my problem….
[  ][  ][  ][O]

[  ][  ][  ][  ]

[X][  ][  ][  ]
if im in the X position and I click at the circle position how could I think the logic for the script to first walk on the Y position and after at the X position
What I was thinking is to make a loop to recognize my Y position and move in Y adding or substracting in my position and after that when Y is equal to the circle do the same process with the X

But now I have the next problem. What if I have an obstacle in one of the places at the grid ….

thanks if you help me with my problem and srry form my english jeje I´m a spanish guy jeje

And just one think I dont want scripts codes here I just want some logics solution to try it by myself cause I like to try write code to learn more of my errors thanks.     🙂

  • Liked by
0 on April 16, 2018

This a link to A* its a path finding algorithm that works really well for grid.

  • Liked by