Platform AI

For questions about using Classic.

Post » Thu Nov 06, 2008 1:39 am

I've been trying for ever but I can never seem to get it right.

All I wanted is for an AI to patrol out a path and then seek out the player when in range or something to that matter. Also being able to jump to other platforms would be a great help.

Another thing is mirroring. I want to figure out how to flip the character so he is facing the character when he is chasing him or something.

Thanks in advance for you help.
B
1
G
4
Posts: 4
Reputation: 1,033

Post » Thu Nov 06, 2008 2:04 am

I've actually been using something EXACTLY like this for my game. I'll see if I can't get an example up later.
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Thu Nov 06, 2008 5:45 am

And... here it is:

Platfrom AI example

It's not perfect, for example, sometimes the enemies will get stuck on the higher sections while trying to get back to you, but this can be fixed if the levels aren't so crowded. Hope this helps. :)
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Thu Nov 06, 2008 3:40 pm

Hey, that's pretty close to how I'm doing it too. I tweaked it a little:

[url:34o2z5t7]http://www.amirai.net/misc/platformai2.cap[/url:34o2z5t7]

Now it works properly if the player doesn't move from the top platform.

Edit: Er, realized that I probably should have commented my edits to the .cap... sorry.

Edits: jump boxes now tell the direction of the jump by their angle
Event 3&4: added when on ground condition
Events 5&6: enemy doesn't turn directions in midair, but does continue forward if stopped by the edge of a platform
Event 10: Added if angle of 'badguy' is equal to angle of jump to prevent incorrect jumps
Set 'badguy' air acceleration/deceleration to 0
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Thu Nov 06, 2008 8:53 pm

I didn't even think of doing that for the jumps. Nice idea. :)
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Fri Nov 07, 2008 12:48 am

Thank you both for the support! I got it working just fine! Though the path finding and stuff isn't the best, it'll do :)

Thanks again for the help!
B
1
G
4
Posts: 4
Reputation: 1,033


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 9 guests