I'm trying to make some sort of AI for a basic platformer. Essentially what the AI is trying to do is jump on the player's head.
My code so far is horrifyingly convoluted and ugly, but it works. It will be cleaned up eventually.
I'm just posting it here hoping to get some feedback on how stuff works, what I could do better. At the moment one of my strongest focuses is on efficiency, so the AI (very obviously) only updates pathing when it has moved a significant distance. The terrain is going to be dynamic and changing constantly, and the target is going to be moving constantly.
There is one blatantly obvious bug that I'll thank you not to call me out on -- when you are standing under an enemy who is on a platform above you they'll just hover left and right without jumping off the platform. Feel free however to offer a fix for it. My brain has just melted from coding for too long, so I can't do it now.
See gif here: (NOTE: FORUM CSS MAY CUT PART OF GIF OUT. GO HERE FOR FULL GIF)
See attach for .LOVE.
Buttons:
- Arrow keys: MOVE
X: JUMP
Q: RESET PLAYER LOCATION (won't reset AI)
Updates:
Made players and AI different colours
Added head-jumping and made it work
Added scores
thx for looking
pls to doge tip DEZUmeevfRQeZKU2oDgLeNg6ALPjouyT5J