0 Favourites

Enemy AI like in Terraria or Risk of Rain

  • Hello this is my first topic posted and I am still new to construct, but i have a question (obviously <img src="smileys/smiley17.gif" border="0" align="middle" /> ).

    I want to make my enemies come towards me and when they come close enough stop and attack and then towards me again and so on.

    So does anyone have an idea how to do it i have the animations required but i dont know how to make the AI.

    Of course if there is a tutorial about this already i would like to get a link for it.

    Thanks in advance, Mihovil.

  • Hi there

    A partial answer cause i never played thoses games (even if it seems good games)

    terraria.gamepedia.com/AI

    It seems that there's a lot of tutorial to implement AI but i always used A* and Dijkstra algoritm...

    I think that there is a lot of way to implement an AI and noone can give it all just in 1 topic.

    Sorry :(

  • Well thanks for the reply anyway maybe i can narrow down my choice. <img src="smileys/smiley1.gif" border="0" align="middle" />

    EDIT: well the AI i am trying to make is fighter AI(thats what its called in terraria according to the wiki)

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Well first i think you have to refine the AI to construct 2 Event Model.

    For example :

    If it fails to reach its target, it will back up a bit, then re-attempt

    The first event seems to be a comparison of :

    Fighter.X + (size from point 0 to weapon) AND Fighter.X + (size from point 0 to weapon)

    => Fighter.attacking=true

    => Fighter set Animation "Attack"

    => ActTimer.start (0.5) // the time to reach end of attack animation

    Fighter in collision with Player AND Fighter.attacking==true

    This is just the begining... but i hope you understand how to.

    I think you should analyse the pattern with event handler and timer

    Sorry for explainning with my own understood i'm not fluent to write event of construct 2 ^^

  • Thanks man but i got it working (it needs a few tweeks though).

    I used compare two values(system) and when x was bigger on my player than on the monster the monster would go right and vice versa.

    But thanks anyway.

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