I
I
Ilya Smirnov2015-02-08 14:15:51
PHP
Ilya Smirnov, 2015-02-08 14:15:51

How to write an algorithm for finding the shortest path with bypassing objects?

I am creating my own game, the question is in building an algorithm for the game, it is necessary to create an algorithm that would lead the player from point A to point B bypassing the available objects on the map. I have a trial two-dimensional array consisting of the values ​​1 (A place where you can not walk) and 0 (A place where you can walk), the player is a circle. Here is an example: intgor.com/game/game3 , this is what I have been able to do so far, a simple movement from point A to point B of the player, I would like him not to "teleport", but walk through the cells. Give me ideas, I'll do the rest myself)) But I definitely need the shortest path, I don't need to suggest a path along the edge of the map!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Don Kaban, 2015-02-08
@Ilia100000

https://ru.wikipedia.org/wiki/Search_A*
www.policyalmanac.org/games/aStarTutorial_rus.htm

R
Roman Zhak, 2015-02-08
@romanzhak

Google algorithms for shortest paths. The Bellman-Ford algorithm comes to mind first.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question