How do I make a platform AI

Get help using Construct 2

Post » Mon Aug 31, 2015 2:17 am

Hi, i am trying to make a platform game with an enemy ai that will try to walk/jump to you and attack you on contact, and for bosses possibly shoot at you. I am really not sure how to do this as there are literally no tutorials on it. Please respond asap as i would like to get a working build out by tomorrow.


Thanks!
Kerpato, CEO of Tactical Train Wreck Studios
B
2
Posts: 2
Reputation: 154

Post » Mon Aug 31, 2015 11:44 am

First of all you should have platform behavior for enemies and "default control" set to No.

Making enemy walk towards player:

Compare player.X < Enemy.X : Enemy Simulate control Left
Else: Enemy Simulate control Right

For attacking on contact use "Is overlapping" or "On contact" condition.

For shooting you propably should first compare distance(player.X, player.Y, Enemy.X, Enemy.Y) to some suitable value to see that enemy is not too far to shoot. If you want to shoot only in horizontal level compare abs(Player.Y - Enemy.Y) to some small value.

For jumping maybe check that distance(player.X, player.Y, Enemy.X, Enemy.Y) is short enough and player.Y < Enemy.Y.
Then you can use Simulate control Up action.

But if you want anything decent out tomorrow and don't have an enemy AI worked out yet, you are propably some weeks behind the schedule anyway.
Lokkim Games: Constructor Dude - Fun platformer game, PuzCro - Difficult puzzle game demo
B
9
S
3
G
1
Posts: 38
Reputation: 795

Post » Mon Aug 31, 2015 3:00 pm

How do you check the distance?
B
2
Posts: 2
Reputation: 154

Post » Tue Sep 01, 2015 6:42 am

Use system conditition "Compare two values". One of the values is distance between player and enemy e.g. distance(player.X, player.Y, Enemy.X, Enemy.Y), and other can be any value you choose.
Lokkim Games: Constructor Dude - Fun platformer game, PuzCro - Difficult puzzle game demo
B
9
S
3
G
1
Posts: 38
Reputation: 795


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, David181, Prominent, tarek2, Yahoo [Bot] and 15 guests