Hey, I'm new to the forums, and have been experimenting with Construct (and similar programs, such as Multimedia Fusion 2) for a good while now.
I've been toying with the idea of a top-view action/RPG-type game in Construct, and have been having difficulty with implementing enemy AI (which, as you would know, is pretty damn important for a game like this.)
As I haven?t been able to find much in the way of action/RPG enemy AI tutorials here on the forums and the wiki, I thought I?d try to adapt a tutorial written for MMF2.
I?ve implemented the ?Improved Chase/Escape Algorithm? from this http://www.clickteam.co.uk/resources/GTM/GTM10.htm tutorial, which basically determines the distance between the player and the enemy (apparently by using Pythagoras? theorem for triangles), and checks if it is lower than the appropriate amount.
Player approach from the West or the North seems to work as it aught to, but approach from the East and South is pretty messed up. If the ProtoEnemy object is approached from the East or the South, it won't be alerted to the player's presence until the player actually passes through the object. I?m guessing this has something to do with x, y coordinates, but I just can?t get my head around it.
This is what the algorithm looks like in the Events editor
And here is a hand-written version of the same; blue is enemy, red is player.
Please note that I am already aware of the LineOfSight behaviour ? my idea is to use that in conjunction with this: for example, having the enemy spot the player using LineOfSight, approach the player and then ?engage? with the player ? stopping a small distance away from him and then making its decisions to wait, jump around, take a swipe at him, etc.
I'll try to post a .cap file if anyone requests it.
Thanks in advance,