What are the benefits of 'families'?

This forum is currently in read-only mode.
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • I'm struggling to properly understand the concept of families after reading the Wiki. Just to what extent can we use them to make, let's say, enemies? I'm now trying to get an Action RPG system up and running and I'm trying to create two enemies in the 'Enemy' family . I know that families allow me to assign each object the same private variables and allow me to create events for them as a whole, but from what I've tried, the type of events one can set is limited. Also, isn't there a way to make containers part of a family? For example, instead of adding HP Indicator to each object of the family, is it possible to add a container to all the objects at once?

    It's very handy for setting health and strength since it creates those variables immediately, but in the end I can't create something like 'Enemy collides with Sword > Subtract 10 HP', since all the enemies in the family will lose 10 HP, unless I'm doing it wrong. From what I've tried I'll have to do it like this: 'Spr1 collides with Sword > Subtract 10 HP', 'Spr2 collides...', etc.

    Also doing something like 'Always > Enemy: Add LOS obstacle 'Barrier' seems to crash the program, so I have to do it separately ('Spr1: add...' Spr2:add', etc.).

    In the end, will I have to create a seperate event sheet for each enemy which has slightly different behaviour values (e.g - bullet speed, LOS Acc., Grid movement, etc.)?

    I probably do have the wrong idea of what a 'family' is.

  • I can't create something like 'Enemy collides with Sword > Subtract 10 HP', since all the enemies in the family will lose 10 HP, unless I'm doing it wrong.

    You must be doing it wrong. Families obey ordinary object picking rules. In that event, only the objects that meet the event will be affected.

    [quote:18ri3ogn]Also doing something like 'Always > Enemy: Add LOS obstacle 'Barrier' seems to crash the program

    Crashes are always bugs, please submit them to the tracker so we can make Construct more stable!!

    See the attached file. It's a quick example proving events involving families work only on the right instances. It's also got a quick and dirty health bar implementation. The health bars are not in a container with the objects, they just 'naturally' pair up one to an instance if there's the same number of objects of each. This works with ordinary types as well and can be very useful. Hopefully it will help you see the real use of families. They can save a LOT of repeated events. I don't know how I'd manage without them!

  • You must be doing it wrong. Families obey ordinary object picking rules. In that event, only the objects that meet the event will be affected.

    Got it working! Well, sort of.

    Crashes are always bugs, please submit them to the tracker so we can make Construct more stable!!

    Just submitted that one and another which was bugging me, though is the tracker working properly? Can't see any other listings like before.

    See the attached file. It's a quick example proving events involving families work only on the right instances. It's also got a quick and dirty health bar implementation. The health bars are not in a container with the objects, they just 'naturally' pair up one to an instance if there's the same number of objects of each. This works with ordinary types as well and can be very useful. Hopefully it will help you see the real use of families. They can save a LOT of repeated events. I don't know how I'd manage without them!

    At first I tried making it custom, though then I discovered containers and thought I wasted my time since it does it for you! Ah well, the method I was trying to accomplish was much too complicated anyway. Yours is so simple and yet accomplishes the task perfectly. Mind if I use yours?

    Ah wait, but I'm spawning enemies... Is there a way to create the same numbers of bars as enemies? Wait, I could just spawn a bar along with an enemy!

    Thanks for your help. Guess my understanding of families wasn't too far off.

    EDIT: I tried replicating your destroy method, though I'm using boxes and texts which don't have a pick random action. Is it possible to add those in future builds?

    Also, this may be a little off-topic, but is there a way to make an object move towards another while keeping the grid movement? So far I've been using rotate to player with a bullet, which complete ignores the grid movement and goes directly towards the player.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > I can't create something like 'Enemy collides with Sword > Subtract 10 HP', since all the enemies in the family will lose 10 HP, unless I'm doing it wrong.

    >

    You must be doing it wrong. Families obey ordinary object picking rules. In that event, only the objects that meet the event will be affected.

    sometimes it is a little finnicky. for example, if you test for a collision but list the family item second, it might pick all the items within that family. so if i'm testing collision between two families, in the past i've had to check collisions both ways for proper picking

    A overlaps object B

    B overlaps object A

    do action

    i haven't tested this extensively -- just a bandaid solution to a problem i've run into once.

  • It shouldn't really matter which way round it is... could you send me an example of the order being important?

  • It shouldn't really matter which way round it is... could you send me an example of the order being important?

    Unfortunetly it does. Even yesterday when i was making an event for character movement, and when i setted up the condition :"<reverse> 'move left' pushed down, 'move right' pushed down -> play animation 'walk' " it did not worked at all. i had to set it up where 'move right' was first.

  • Wow! What an timesaver:) I should really read the tuts and wiki

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