I have a theory on how to make the AI walk around the level, from its position to another position.
First of all, scratch the grid idea. A grid isn’t needed, just the positions and sizes of the level rectangles are fine.
To have the bot walk across the level from point A to B, we can probably use a pathfinding algorithm to do this. First, we get a list of surfaces the AI can walk on. This is mostly pretty straightforward to do.
This is the level:
And these are the surfaces:
It then splits up each surface into a bunch of nodes arranged in a grid-like pattern.
Anyway, the next thing that happens is that it connects each surface to one another. These connections would represent jumping/falling. To do this, it goes through every other rectangle and sees if the AI can jump and/or fall onto it. It can jump/fall on it if the quadratic function I wrote about earlier (wait that was six days ago??? i thought that was three days ago what??) intersects with the surface. The end result, when visualized, would preferably look like this:
Red are the platforms the ai can fall onto, blue are the platforms the ai can jump onto, and purple are platforms the ai can both jump and fall onto.
(Actually the falling connections and the jumping onto connections would be completely different, I just combined them into one because I was too lazy to draw an entirely separate arc for the jumping)
Then, with this information, we can use a pathfinding algorithm to get the player to traverse to a desired point. I found a good web page explaining pathfinding algorithms here: https://www.redblobgames.com/pathfinding/a-star/introduction.html (don’t ask why they have third-party cookies from facebook idk why lol)
The AI can only walk to a certain node, not to a certain position on the actual screen. Walking to a certain position on screen would actually just make it walk to the closest node to the position.