Make multiple enemies behave on their own?

1 favourites
  • 7 posts
From the Asset Store
Pixel Enemies for SHMUP consists of 38 enemy ship sprites to be used in your game.
  • Hello everyone,

    I started with Construct a few days ago and so far have been having a great time. However I seem to be stuck on making multiple instances of the same enemy not mime each other.

    I've set up an event sheet for the enemy and made some event groups for things like attacking, being idle and getting hit by the players attacks. These work great with only one enemy, but if I drop in some more they all move exactly the same and will all attack even if the player is in range of only one.

    If somebody can point me in the right direction it would be greatly appreciated.



    (WASD to move, click to attack)

  • Welcome!

    I looked at your capx, and I'm thinking that instead of testing for distance using the distance function, you might pin an invisible sprite to each glob to simulate each one's range of sight. You can make it as big or small as you want.

    Whenever the player collides with it, the individual glob it's attached to will react by attacking or fleeing or whatever.

  • I didn't look at your capx, but using groups for multi-instances programming isn't a good idea as groups are globally activated or deactivated. So if one of your instances triggers the activation of a group, the code within this group will be executed no matter what.

    You should use instances variables and check them in a top event for each of your states.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here's a quick example of how to get individual enemies to respond using an invisible sprite for range of sight. I've kept the sprites visible in the example so you can see what's going on:

  • Thanks for the help guys. I think I've got it figured out, now I just need to get to work!

  • Holy joeykid6!! this capx helped me a lot!!!!!! thank you mate =) Exactly the example i was looking for!

  • We also have the new turret behavior now that can also be used to check targets within range.

    Edit: went ahead and made Joeykid6's example work with turret movement.

    This automates rotation speed, and give you other options like predictive aim, where the bad guys can anticipate your direction.

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