Enemy AI

0 favourites
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Hello, I hope you can help me. I wanted to do is that when the enemy is at a distance x comes to attack <img src="smileys/smiley4.gif" border="0" align="middle" />

  • Use the distance() expression.

  • How it works?

  • you can do me a small example? <img src="smileys/smiley5.gif" border="0" align="middle" />

  • distance(player;x,player.y,enemy.x,enemy.y)

    It returns the distance between the player and the enemy.

    IF distance(player;x,player.y,enemy.x,enemy.y) < [EnemyAttackDistance]

    THEN... Enemy attacks :)

  • I'm new to this program, you could do it in capx? <img src="smileys/smiley18.gif" border="0" align="middle" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Under the systems options when creating an even there is an option to compare two values. Use the formula Ragtime mentioned to perform the actions you described.

    In short:

    Event>System>Compare two values> enter distance formula to make the IF X distance

    then do whatever you want them to do to "attack" the player.

  • Dear friend....what the learned Herald of Time and other fine gentlemen ...mean to say is that you should add a new event in the Event sheet click System Compare two values...it will look something like this... when you find it....

    He means this...?

    We could make you a capX but then you wouldn't learn where the button was..and for your next game it is a fair to reasonable presumption, at this stage that you would ask a similar question again..

    If you are new to Construct 2 as you mentioned...The Newly finished MANUAL is a really good idea to "start" your epic adventures into becoming a star performer...Do some serious reading..Grab a few bikkies and a cup of tea coffee or yak milk and grace your eyes and brain with as many of the exquisitely crafted pages of the manual as you can muster in a single setting..The more you put in the more you will get out..

    Do as much as you can to get familiar with the BASICS of Programming...you have to experiment...we all get it wrong..but try to do much of your own research before posting lest you appear trollish.:)...and look for other posts first if you can...you answer may already be out there...

    In response to this thread and others, I am currently working on a Plugin BASIC-COMPLEX A.I.Sub-Routine for Construct 2 that will work for any Plat-former and eventually for any game time...I am doing plat-formers first because there is a lot of complex stuff that isn't needed in other types of games for enemy AI...

    Complex AI takes time..so be patient and you soon will have a free Template for any platformer Enemy AI.. a Fully customizable template that will include node based path selection, patrolling, Targeting & weapons firing, Melee functions,evasion, Idle states etc..but yeah if you really are serious about being a game dev..better get reading...you will need at the very minimum 3 weeks of solid reading and experience to get a decent game going...its not too much...There is no "make game" button...a solid game AI can be hundreds of lines of instructions that all have to work seamlessly together and for any environment..making a Universal AI is not easy unless you want the A.I.to only do simple tasks like..just sitting there and saying "make me an AI"   <img src="smileys/smiley3.gif" border="0" align="middle"> <img src="smileys/smiley42.gif" border="0" align="middle">

    The plugin or simple Capx Template currently in the making will be fully commented so you can understand the ins and out of the system, and why everything is the way it is...

    Be patient and read up in the mean time..its good for the mind...

    My Plugin wont be ready for a week or so depending on testing...

    In the mean time I recommend checking out farsmile90's "Chaos Game Example"

    It has loads of cool features in there....if you can spend the time figuring it out...well worth the look at how Farsmile90 went about a simple AI

    Unfortunately The Event Sheet is not commented at all so..

    You may find it harder to follow but it does use the native/standard Construct 2 Event Sheet Scripting language...so it isn't too hard to figure out...and you learn at the same time....Great stuff...Kudos to "farsmile90"

    Looking forward to seeing your first game...best of luck..

    love and other fluffles

    <img src="smileys/smiley2.gif" border="0" align="middle">

  • Of the distance as I understood, but as I get the enemy go towards my to attack me.

    action that I have to do? <img src="smileys/smiley5.gif" border="0" align="middle" />

    Thanks for answering <img src="smileys/smiley12.gif" border="0" align="middle" />

  • <img src="smileys/smiley6.gif" border="0" align="middle" />

  • anyone? <img src="smileys/smiley29.gif" border="0" align="middle" />

  • Nobody helps me? :(

  • <img src="smileys/smiley6.gif" border="0" align="middle" /> <img src="smileys/smiley6.gif" border="0" align="middle" /> <img src="smileys/smiley6.gif" border="0" align="middle" /> <img src="smileys/smiley6.gif" border="0" align="middle" /> please help me

  • mystazsea thank for your comment, i'll keep upload some of my game's example. :X

    By the way, the url to download my game is wrong, it's here :


    IF you don't understand, just mail me.

  • Try the beginners tutorial , because I don't think you did it !

    It covers all the basics !

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