0 Favourites

How do I make a platform AI

  • 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

  • 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.

  • How do you check the distance?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
Tutorial: Platform School
267 93,729
Megabeard's avatar
Megabeard
Unread hot topic
167 14,489
DMT2005's avatar
DMT2005
Unread sticky
1 Favourites
C2 Games made with CocoonIO
136 89,815
minhcuong's avatar
minhcuong