0 Favourites

Enemy AI

This forum is currently in read-only mode.
  • I have been searching around so much but i can't seem to find anything about it. I want to know how to make an enemy. When it sees the player it will chase him and if it dosent see the player it will walk around.

    Thanks

  • Because of the LOS and RTS behaviours it's very easy to simulate AI (RTS has pathfinding and object avoidance) (LOS = line of sight).

    You can add behaviours to an object by looking at it's properties and clicking : add behaviour.

    Example,

    IF enemy has player in LOS

    + move to: (Y) player.x (X) player.y (RTS)

    IF enemy DOESN'T have player in LOS (you can invert conditions by right clicking on them and then "invert")

    + move to: (Y) enemy.value('ystation') (X) enemy.value('xstation') (RTS)

    Enemy value "xstation" and "ystation" determine they're starting position. you can set those automatically with the event :

    Start of layout :

    set enemy.value('xstation') to enemy.x

    set enemy.value('ystation') to enemy.y

    This is of course a very (EXTREMELY) simplified AI, you just have to get more creative I.E. having the enemy's also check distance between them and player, make them stop and look around after losing sight of player and things like that .

    Also : this is my first post!

    Edit : If your talking about platforming AI, completely disregard my post .

  • I have been searching around so much but i can't seem to find anything about it. I want to know how to make an enemy. When it sees the player it will chase him and if it dosent see the player it will walk around.

    Thanks

    You could set up "states" for your enemy. If the player is close, set the enemy state (a private variable) to "active." If the player is far away, set it to "passive."

    Then you can use those private variables to run blocks of code that will control your enemy. You just need to use that variable as a condition in your events.

    Other than that, what methods have you tried? It's easier to help someone fix something that's broken than just tell them how to make it.

    (By the way, I cover some simple enemy AI in my Platform School tutorials.)

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I am a newbie at construct but eager to learn. Im trying to create platform enemy and i have tried all different behaviors but i dont know wich one i should use :/. I have used Platform behavior and LOS but i dont know what to do.

  • You're not going to learn anything if you don't learn HOW to learn .

    It sounds as if you think you can make a game from only using behaviours.

    Since you're a beginner, I strongly suggest you create a bunch of 1-level projects and fiddle around in construct, testing events and figuring out what does what when and where, Instead of just throwing up your hands and saying : "how do I do this?".

  • I am a newbie ...

    i dont know what to do.

    Do this:

    http://sourceforge.net/apps/mediawiki/c ... r_tutorial

    Then do this:

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