# What path-finding technique do I use?

So I have this 2D game that I am working on and it takes place in a building. What I need is a pathfinding solution that will make my player go to a specific destination in the shortest path. Here is an example of my level:

So here is the problem:
You start at ROOM 1 and must go to ROOM 4. In order to travel between rooms, you must go through each door (the brown squares). Each door will lead to the corresponding shape found on top of the door. If I go through the door that has a Triangle on top, I will come out the other door that has the Triangle on top.

So, how do I create (or implement) a pathfinding solution that will get my AI from Room 1 to Room 4?

I’m facing a similar problem, Waypoints are what you want, if I had to guess how the structure would be, Have a event that executes when the AI is at a door or waypoint and have him move to the next room and have other code that logically finds the required paths and waypoints to get there in reverse from the target to the AI. Then have the AI note the required paths to get there and do them one by one and take them off the stack when the path is traversed or the AI walks to a waypoint.

TL;DR Waypoints, You need them!

You can actually do a classic A* with this no problem.

You just need your A* to know the teleportation points. The square on the other side of the teleporter is treated as a “neighbor” for purposes of the A* algorithm.