How do I sort out my enemies and detector box!

0 favourites
  • 4 posts
From the Asset Store
amazing template of the game of ordering colors with strings made with construct3 (requires c3 license) optimized with j
  • Good morning all.

    I'm attempting to move all my enemies into a family.

    I've managed to get movements sorted out and "food" collection sorted, but this is where I am falling short.

    Instead on placing one of each of the enemies within the family, it is placing 3 or 4 of random colours.

    -> On start of layout

    -> enemy - set position to (random(7600), random(4200))

    It does set places in random, but not one of each.

    I also can't get the Enemy_detector to center on each of the enemies, instead it seems to either splat randomly on the layout, of as like a relatively equidistant spot between them all.

    With the event

    ->For each enemy(this is a family)

    ->enemy detector - set position to (enemy.x, enemy.y)

    And finally...

    How do I make a collision exclusion for each enemy within the family.

    so the detector doesn't' detect the enemy it is centered on...

    I'm thinking I may have to put each detector on each enemy separate to the family group.

    sorry for being a P.I.T.A folks... Theres only so much my brain can work out :/

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You kind of answered your own queries there near the end, families are good for minimizing redundant code in some scenarios like when you have the bullets hitting all 'enemies' as one family, but sometimes they are not useful for picking. If you create a family it will create a random object not one of each, you'll need to do something outside of the families such as set a variable to a random number and each number corresponds with spawning an individual enemy object type.

    I'm not sure about the detector logic, are you saying enemies detect all other enemies but not themselves? You could do something where each enemy(family) has an ID, it's an instance variable set when they are created, assign it to the detector they have and say that the detector detects all enemies besides the one that matches its instance variable ID.

  • I’m glad my brain can still problem solve, though I’d burned it out.

    The detector box does detect anything.

    Because I broke it (and yet my brain still causes problem) but it was spam killing it’s self, as it was detecting enemy in the box, all enemies are in family, so it self is seen as an enemy. I’m guessing it could just be a case of setting it up out side of family, assuming the variable ID doesn’t work, but it should do I imagine.

    Also, I think I may have to assign each enemy a detector box individually as assigning it to enemy family only seem to apply one to the game (I made it visible so I could see it) rather than to 1 on each of the 4 enemies...

  • The food=0 event is a little messy and it won't be picking the things you want. I would try having an event on enemy created, enemy spawns food detector. That will create a detector at each enemy.

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