families bugged?

0 favourites
  • 8 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • I was trying to get a function to select objects in a family that did not have the (UID) in the param, and I couldn't get it to work.

    I have 2 families, which both holds the same objects. With a function i wanted to pick objects in Group 1 with UID 1, that worked, but when I tried to pick objects with or without UID 1, from Group 2 it didn't work.

    None of the conditions above worked for picking objects in Group 2. Is this a bug or am I missing something. It doesn't make sense.

    edit, this didnt work either.

    Capx.

    https://dl.dropboxusercontent.com/u/20560446/Scirra/family_error.capx

  • Event 9 picks by Group 2, but alters Group 1. All of Group 1 are picked.

  • blackhornet , so you can't pick UID by one group and alter by another. Felt like it shouldn't make any difference, since an UID is always same no matter what family the object is in. Oh well... back to the drawing board.

  • Say the uids of all the objects in the groups are 0,1,2,3,4,5.

    Then right before event 8 the "selected object list" or sol is all the instances in both:

    group1= 0.1,2,3,4,5

    group2= 0,1,2,3,4,5

    Then in event 8 the condition "group1:pick by uid 1" modifies the sol to:

    group1= 1

    group2= 0,1,2,3,4,5

    and the action "group1: set opacity to 50" takes the picked group1 or instance 1 and makes it's opacity 50.

    Next consider event 9.

    Right before it runs the sol is:

    group1= 0.1,2,3,4,5

    group2= 0,1,2,3,4,5

    Then in event 9 the condition "group2:pick by uid 1" modifies the sol to:

    group1= 0,1,2,3,4,5

    group2= 1

    but then the action "group1: set opacity to 50" is the same as in event 8. It takes the picked group1 or all the instances (0 to 5) and makes their opacity 50.

  • R0J0hound So what's the best way if I want to use Group1 for picking UID's and Applying them To Changes by those picked UID's to Group 2? I have to load all the UID's to an array? use for each X of the array to pick UID's in Group2 and apply to group2?

    I thought I could be smart to Pick objects by UID in one family, then make changes to objects in another family based on the UID's picked from the first family.

  • blackhornet , so you can't pick UID by one group and alter by another. Felt like it shouldn't make any difference, since an UID is always same no matter what family the object is in. Oh well... back to the drawing board.

    So if you filter out (is on screen, is moving) ONE object in group 1, and you feed the UID of that one object to the function, then all you got to do in the function is pick by comparisation > object = group 1 or 2 (does not matter) expression = group.UID ... value is the parameter .. operator ><. And do your stuff in the actions. Because all but that one with that UID will be in the picklist in the function. A function ALWAYS starts picking from scratch.

    But, i suppose 'is on screen & is moving" does not pick ONE object, but a bunch of objects. So in the picklist there are more objects. Looping trough those and it feed them one by one to the function will not solve it. Because the first index in the loop will select other objects then the next index in the loop, and in the end you see only what happend compared to the last object in that bunch of objects.

    The solution here is not use a function. But think the other way arround. Pick straight.

    Condition > invert the 'on screen'

    Condition > invert the 'is moving'

    Now you have everything picked that you wanted to pick. Do your stuff in actions.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So basically you want to copy a sol from one family to the other. Typically there is better logic than doing that but if you must i can think of a few ways:

    https://dl.dropboxusercontent.com/u/542 ... _copy.capx

    If only one object is picked of group1 then "group2: pick by uid group1.uid"

    If multiple objects are picked in group1 copying it over will take two events. One to mark the instances so that group2 can pick then and a second to make group2 pick them.

  • So basically you want to copy a sol from one family to the other. Typically there is better logic than doing that but if you must i can think of a few ways:

    https://dl.dropboxusercontent.com/u/542 ... _copy.capx

    If only one object is picked of group1 then "group2: pick by uid group1.uid"

    If multiple objects are picked in group1 copying it over will take two events. One to mark the instances so that group2 can pick then and a second to make group2 pick them.

    Great example, thanks R0j0. The visibility solution was genius, as I've stumbled across similar problems before where instance variables don't work. The other solution I will study further as it's a bit above my level, as i didn't even knew you could do that.

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