Enemy Tank AI

This forum is currently in read-only mode.
  • Like I said in my previous post, it wont work with waypoints anyway.

    But, in theory you could do as GMG suggested, and make his assumption work.

    You can do that by spawning a dummy object, and setting the waypoint to the dummies x,y.

    Then if the dummy overlaps the wall, destroy it, and spawn another random position.

    You should keep in mind that waypoints add a ton of processing, so if you have many enemies moving around its going to bog down the system.

  • Ok, I made a new dummy object, now it works... almost!

    The thing is, that two waypoints (dummy object) are created, when two enemies are on the screen.

    Now when one of the enemies overlap the object, than it gets destroyed and another one gets created. Now both enemies follow the same waypoint and the other object gets left behind.

    I'm still clueless.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well I'm not sure exactly what your doing, but it sounds like you want two different enemies to follow two separate dummies? If thats the case you can either spawn a two different dummies IE two different objects, or two instances of the same object, and use a private variable to pick which one to follow. Something like:

    dummy(pv)=1

    enemy (pv)=1

    ->enemy add waypoint at dummy

    dummy(pv)=2

    enemy (pv)=2

    ->enemy add waypoint at dummy

  • Well, I'm doing like this:

    There is a spawn Object of the enemy, to make the level editing and events a lot easier.

    Now, in one level there are two spawn objects and in another level there are 4 spawn objects.

    So I made the event to make a new enemy sprite at the position of the spawn object and destroy it.

    I made it like this, because I want to also make a Level Editor (as seen in my other thread), making things a lot of easier.

  • Put your dummy object into a container with your enemy tank. Each tank will have their own dummy object, and picking in events should use the correct dummy. The events might get fiddly but they should work.

  • Not a bad idea. Just the same problem still exists. Both tanks are still following the same dummy object. While the other dummy gets left behind. Just to note, there are not two objects of tank in the layout. there is only one of them and two spawn object.

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