How do I make an AI follow a path

0 favourites
  • 12 posts
From the Asset Store
Move around the rectangular and travel as much as you can!
  • Hi All,

    I am very new to construct2.Hardly few weeks old.

    I want to achieve the following in my game.

    Make the player move in any direction - I did that using 8-direction

    To make the bad-guy move only in particular direction - ??

    these images might be very clearly saying what I am looking for:

    <img src="http://pinastro.files.wordpress.com/2012/06/mobility.jpg" border="0" />

    and

    <img src="http://pinastro.files.wordpress.com/2012/06/mobility2.jpg" border="0" />

    Thanks

    Karthikeyan

  • pinastro, the easiest solution that i can think of now, is to only move certain enemies in certain bridges, i mean, if you don't make all of them walk in all of the bridges is easy to simple put an invisible sprite in each path and everytime that an enemy touch one of them, you simple change it's direction. But if you wanna move all of them in all of the bridges it would be a little more complicated but can be done, if you are not good with the first solution, let me know and i can make you something that maybe you can use as an example, ok?

    See ya!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here is how I would do it with invisible sprites for the islands and angles of the bridge paths.

    Commented .capx: EnemyBridgePatrol.capx (r95)

  • Behamut

    I certainly do not want to move all of them in all the bridges.

    Can u give me the link that explains putting an invisible sprite method.

    I am not much well versed with the engine... something like this game

    scirra.com/construct2/demos/moon-shield

    the objects never move out of the orbit..may be i am giving a wrong example.

    thanks

  • Nimtrix let me check ..thanks :)

  • I did this with my behavior i made. Here is a demo.

    Demo

    Behavior

  • this is the tutorial for making a platform game, inside there is the explanation on how to make invisibles sprites, and maybe you can learn a few new things by reading it,

    scirra.com/tutorials/253/how-to-make-a-platform-game

    hope it is useful to you, anyway, sorry for the delay in the response, i believe we are in differents times zones,

    anything else, just ask, see ya!

  • All thanks.

    I was caught up in my daily job schedule :(

    I am trying to figure out how the events were written for the EnemyBridgePatrol.capx given by Nimtrix

    I guess I need a some manual sort to understand a little more complex (programming like) features in construct2.

    Please give me some time to understand what you have given :)

    rfisher

    rfisher's solution sounds an easier way..but i still might have to think about the AI movement in this case.This this way I stumbled upon one few questions about SOLID behaviour.

    (a) Can we dynamically set the 'Solid' behaviour in-between (during)the game play ? if so how ?

    (b) Can we set the 'Solid' behaviour valid only to the AI and not for the player ?

    i have tried something here

    pinastro.files.wordpress.com/2012/06/solidbehaviour.jpg

    what i want is the player not stopped by the invisible solid object on both side of the bridge (I am not really sure how valid is this question?)

  • pinastro

    Here is the CAPX for the demo you saw.

    Demo capx

    Its really simple the way it works. I do plan on adding an Array string that will hold the way points then using a invisible sprite, but i haven't implemented it yet.

    I'm not sure on your question (a), but i would have to say no.

    For question (b) the answer is yes.

  • I added some more comments to clarify how it all works (hopefully). You should probably read up on instance variables and booleans in the manual. 'For loops' as well, if you're not familiar with how loops work.

    Anyway, if there's anything specific you need explained, just ask.

    More commented .capx: BridgePatrol_Comments.capx (r95)

  • aahh ...sorry I am back ...I finally found time out of busy day job :)

    collegetomato.com/test4/freshStart2

    I was able to replicate BridgePatrol.but i see that (probably due to the math) after some time the enemy goes away from the bridges.

    I guess it's something to do with the accurate placement of the enemy on the bridges.

  • I got it :)

    Quite slow i am :)

    it works now perfect

    thanks a lot

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