Block Breakers!

I’m almost done with the first iteration of my game :smiley:

— On AI in 2D —
The AI in this game searchs for a random point to move towards, here’s the pseudo code if you want to try this for yourself.

  • The AI sets a random point.
  • Check if the random point is clear, if not, search again until a clear point is found.
  • Check is there’s an obstacle between the AI and the random point.
  • If there’s an obstacle check if there are more obstacles around the first obstacle (Now that’s confusing).
  • Turn the group of obstacles into one giant obstacle in the shape of a square.
  • Get the corners of that giant obstacle with and offset so the AI can walk through without getting stuck.
  • Create a path based on the corners.
  • Procede to move through the path.
  • If there’s no obstacle just move to the random point.

I’m not posting the code because it still has a lot of issues that still need to be solved and it also needs a much smarter way to create the path.

1 Like

Privacy & Terms