How do I

0 favourites
  • 4 posts
  • Hi,

    I'm having problems with adressing enemies in a family. Generally applying damage to members doesn't seem too work correctly, can someone give me a general idea what the correct approach is, to reference an individual in the family?

    I'm defining damage on collision per family and have my individual enemy types react to it differently, but i always get an individual per type not reacting correctly. How should i reference them correctly?

    Example:

    The 'enemies' family has a 'damage' variable. When hit I add to its damage.

    [attachment=0:1l3cmgrv][/attachment:1l3cmgrv]

    As each member type has different 'health' values, each member should compare the damage they took against their own health.

    [attachment=1:1l3cmgrv][/attachment:1l3cmgrv]

    Isn't this how it should work?

  • That wont work correctly, "Bot" and "Enemies" are two different objects, even though "Bot" is part of "Enemies", it doesn't know what "Enemies" you are talking about in the second screenshot. If you change all "Bot" to "Enemies" in screenshot 2 it should work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Problem then is, I need to check against the bot type's health as it's different for other enemy types.

    If I change it to 'enemies' how do i make sure everyone in the family compares it to their specific health?

  • Try this:

    First make the event in the second image a sub event to "On collision with the bullet" event. Change Bot to Enemies. Your health Value should be Family Variable and not Instance Variable. You still will be able to set it for different types of instances the way you want it, at spawn, or in the editor for example. But if you're checking for collisions with enemies, you got to keep it this way.

    And for future reference, if you want to pick specific instance, what you do is: Pick Instance BOT by UID = Enemies.UiD ( If On Enemies Collision with an object for example, in your case)

    Hope that helps!

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