*Resolved How do I control Family Variables

0 favourites
  • 2 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • What I am trying to do is control Hit Points in the Enemy Family.

    I am not sure how this is done.

    How can I set Hit Point for 'enemy A' to X and 'enemy B' to Y.

    How can I subtract Hit Points from specific 'enemy'?

    I looked at functions, but all the examples have me thoroughly confused, and I can't figure how to set up even a simple function.

    Family 'bullet' on collision w/ Family 'enemy' --> Family 'enemy' Hit Points -1

    *but this does -1 to all enemies not specific enemy

    Also can't figure out how to set HP for different enemy types.

    HELP!

    EDIT: Codah example is perfect!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm no expert at C2 but your question got me to experiment a little. Have a look at the capx and see if it helps at all. The thing is, you shouldn't have to think in terms of specific enemy objects most of the time as C2 does that for you. The sample has 2 enemy types, in the same family. Collide the red box with the others to see how their HitPoints instance variable changes for each instance.

    It has a simple function too so you can see how they work.

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

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