Users browsing this thread: 1 Guest(s)
Maze AI Enemy
#2
(04-29-2020, 06:42 PM)bedge Wrote: Hey all! I have a question regarding Game Maker studio 2 DND!
    
I'm creating a game similar to Pac-Man and so far I've created the maze and can have the player run through it picking up objects. I am struggling to find answers on not only how to move my enemy, but move it through a maze AND change its image so it appears to be facing in the direction it's going. 

As you can probably tell, I am extremely new to GM! If you have any ideas I certainly would appreciate it!

Well, AI like that is kinda hard to make. If you're going for something simple, you can just make something that just constantly moves through the maze, and follows the player if there's a clear path. To make something that always follows the player, the best thing I can thing of to do is to make the object search along all the paths that lead toward the player in one frame, then move according to that path. Something like this is really hard to make, though. The people who made the original Pac-Man deserve a lot of credit for making such a good one with the resources they had back then.
As for facing the right direction, if you have a different sprite or image index for other directions, just set it to the appropriate one depending on the direction. otherwise, set the image_angle to the appropriate one depending on the direction, or if you're using the 'direction' value to move the object, which I kind of doubt, just set image_angle = direction.

If you're new at Gamemaker Studio 2, and using DND, I strongly suggest watching tutorials on starting with GML. It might seem hard at first if you haven't had any prior experience with any other coding languages, but it's much easier to learn than you'd think, and it's definitely worth it.

Sorry if this doesn't help much, but there's not much for me to explain in detail with just words.
Watching as many tutorials for beginners as you can, even if it's on a subject you don't think you'll ever use, is probably the best thing you can do. I can't stress enough how important this is to learning more about how to make what you need.

Anyway, good luck with whatever you plan to make in the future! And if you ever feel like it's too much work to learn it all, force yourself to, anyway! That's how it's done.
Dr. Anime
Reply
Thanked by:


Messages In This Thread
Maze AI Enemy - by bedge - 04-29-2020, 06:42 PM
RE: Maze AI Enemy - by Dr. Anime - 05-26-2020, 12:53 PM

Forum Jump: