Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: sebaslive on July 12, 2013, 09:24:35 PM

Title: 2D enemy Ai
Post by: sebaslive on July 12, 2013, 09:24:35 PM
Hey all, I need a suggestion for the enemy Ai in the game. I have him use move Towards to attack the player and is shooting off raycasts to see if it is grounded/wall in front. It jumps if there is a wall in front but sometimes it may fail in it's attempt and start hugging the wall because it is still trying to move forward.

(http://img534.imageshack.us/img534/986/1d4r.jpg)

I am using addforce to make it jump (which sometimes shoots randomly as you can see) so if anyone has any suggestions on how to avoid this or a proper way to achieve the Ai please let me know. If there are also any suggestions towards the combat or anything else to improve that would be great too!

Here you can try it yourself. w/d Left/right to move. Space to Jump. Left mouse to attack.

https://dl.dropboxusercontent.com/u/43466779/Desktop.html (https://dl.dropboxusercontent.com/u/43466779/Desktop.html)
Title: Re: 2D enemy Ai
Post by: jeanfabre on July 15, 2013, 02:42:24 AM
Hi,

I played the game, I don't see any problems in the behavior at all, it's actually very clean and works reliably. Can you make a screencast or something if you can replicated this? thanks.

bye,

 Jean
Title: Re: 2D enemy Ai
Post by: sebaslive on July 15, 2013, 03:01:27 AM
Hey Jean!

If you have him follow you and jump into the left pocket he will do it and get stuck on the wall. The image above is one I took of it happening.

The actions are working okay but I am thinking there is a better way of accomplishing the desired effect so he doesn't stay running into the wall.

Thanks
Title: Re: 2D enemy Ai
Post by: jeanfabre on July 15, 2013, 05:12:52 AM
Hi,

 ah yes, I see it now.

you should adjust the friction of the material you apply to your character, make it 0, and then it will slide up and down along walls happily without problem.

bye,

 Jean
Title: Re: 2D enemy Ai
Post by: sebaslive on July 15, 2013, 05:43:27 AM
Ah of course! Thanks Jean for the help as always.
Title: Re: 2D enemy Ai
Post by: Flying Robot on July 15, 2013, 06:58:49 AM
You can look into this. The enemies need a little pathfinding.

http://hutonggames.com/playmakerforum/index.php?topic=3961.0