How do i use attack family instance multiple units?

0 favourites
  • 5 posts
From the Asset Store
SCI-FI Units SFX contains 456 sounds With this pack, you can voice almost all the units in your sci-fi strategy game
  • hi there! i've been stuck on this for a while and still haven't figured out how to do this.

    its a turn based game (how to attack left click on unit)

    Example:

    Family 1 (player's units)

    Green unit attack/dmg 2

    Yellow unit attack/dmg 4

    ---------------------------------------

    Enemy Family

    Red unit Health 10

    purple unit health 6

    for some reason i only do 2 dmg (green's dmg) and not yellow so how do you select a specific unit in game to deal that amount of dmg to an enemy?

    or do you need to make separate instances? any help i appreciated

  • Where do you define damage amount for each player's unit?

    If you have "damage" instance variable on PlayerFamily and "health" instance variable on EnemyFamily, then it's should be very simple:

    Subtract (PlayerFamily.damage) from EnemyFamily.health

    If this doesn't help, please share your .capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I do understand that but the thing is if i do that it will only deal 2 dmg (or always the the first family unit/object instance number

    so the real question here is how do you select a unit in game and register their attack value on an enemy

  • You need to pick one member of the family first.

    How do you select which unit to attack with? Do you click it with a mouse or something?

    Then I'm guessing you have an event like this:

    On object PlayerUnitsFamily clicked

    Inside this event the correct member (instance) of the family will be picked and PlayerUnitsFamily.damage will refer to this picked instance.

    There are lots of other ways to pick instances, this is probably the most powerful and important concept in C2.

  • ok, it works now thanks!

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