Basic Top Down Shooter Buddy AI
Posted on June 06, 2008 at 8:31 AM
Obelisk made a blog entry the other day, asking about this:
You have a character. Whenever you click on him, he'll become selected. You'll click somewhere on the screen, and he'll move to that spot. He avoids running into buildings and whatnot. Whenever he's not told to go anywhere, he just follows another character controlled with WASD. Whenever he comes across an enemy, he shoots at it. Pathfinding would be direly important, if I knew how to do it then I wouldn't even be asking someone else for this.
I hope this example helps him, along with anyone else who may be curious as to a simple but effective way to do this.
Left Click: Shoot
Right Click: Set/Remove Destination point for buddy
This example is throughly commented, and includes some sprites and music which you MAY use if you give me credit for them. I don't mind if you copy and paste bits of code without crediting me, but if you use this as the main foundation for your game, please give me credit for it. Enjoy!
This example requires GM7 Pro.
Comments are currently disabled on games.