Advanced Enemy AI?

0 favourites
  • 7 posts
From the Asset Store
Give Sound to the enemies that are part of your game! :)
  • I'm trying to make advanced AI for the enemies in my game. For some context it is a top down shooter and the enemies (currently) simply move towards the player when they see them. I would like to make it so if the enemies health is low (15% and lower) they run to cover. How would I do this?

  • The easiest way, would be to have an invisible sprite behind some cover object, or multiple sprites. Then have an Event that checks to see if an enemy's health variable is below a set value. If so, have it find a path to that invisible move to sprite, and then move to that sprite. If you have multiple move to objects/sprites, you could have a choose action, so it chooses one of the sprites to move to.

    I hope this makes sense. If not, I could go into more detail, or just make a quick example if I have some spare time.

  • The easiest way, would be to have an invisible sprite behind some cover object, or multiple sprites. Then have an Event that checks to see if an enemy's health variable is below a set value. If so, have it find a path, then move to that invisible sprite. If you have multiple move to objects/sprites, you could have a choose action, so it chooses one of the sprites to move to.

    I hope this makes sense. If not, I could go into more detail.

    It does make sense to me and that's exactly what I was thinking but this is where it gets more complex. I would like the enemies to then move to a different thing of cover if the player gets to close and from time to time peak from behind the cover and shoot the player.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Okay in that instance, there is an option to check to see if the player is in view of the enemy, then if so, have them perform their actions.

    EDIT: Or check the distance between the enemy and player, if you don't want them to wait, until the player is in their line of view.

  • Alright I'm pretty sure this will work. Thx! I'll try it when I get home.

  • Alright I'm pretty sure this will work. Thx! I'll try it when I get home.

    Sure thing! Always happy to help, where I can :). Let us know how you make out.

  • And if it does work I will most likely ask some more questions because I'm trying to make one of the selling points of my game be the enemies advanced AI

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)