How do I affect only the spawned object of the same type?

  • Hi all, perhaps I'm wording something wrong, but I couldn't find an answer to this:

    If my object spawns an object of the same type after certain actions how do I only affect the spawned object? Most importantly I need to set this new object behind the "parent" object.

  • Cant you just pick it ?

  • How do I pick it if it's the same as parent object and set it behind the parent (zorder)?

  • Well this works. I dont know what you are doing exactly..

  • It may work, but it's not what I need - bottom of layer is not the same as "Behind parent object", so this:

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

    doesn't work.

  • Probably need to use a family then so you can pick both.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, that doesn't seem to affect anything, which is why I'm asking here - I suppose the ideal way would be if we could just deal with all objects by UID - pick this by UID and place behind this, picked by UID.

    Hopefully someone has a solution.

  • Well, that doesn't seem to affect anything, which is why I'm asking here - I suppose the ideal way would be if we could just deal with all objects by UID - pick this by UID and place behind this, picked by UID.

    Yeah it can be a real pain not being able to do it that way.

  • How about trying this way. Layer 1 could be any temp layer just used for this purpose. Again i dont know how it fits with your code but it might work.

  • Hey, thanks for trying, but that's still a workaround - I use stuff like that (another layer) for the first outline effect and selection outlines seen here:

    This system can have up to hundreds of objects - so it's important this works per object. If this could work as described my system could have outlines on every part - and easy to turn on and off. This would make making "cel-shaded" sprites a snap.

  • If you pick by Family, and Create Sprite it can be done. Spawn isn't working for some reason, with a Family. This may be a bug. I need to experiment a bit more to see if this should be reported.

  • blackhornet - thanks, that sounds like a usable approach - these weird differences in, for example spawn and create can be confusing. I was going to need families anyway for some upcoming stuff so hopefully this is the ticket.

  • Here's a function to take an object by uid and move it behind another object by uid.

    It handles sprites and tiledBgs but hopefully you can see how other plugin types could be added.

  • R0J0hound - cool, I'll try to implement it once I finish the current batch of features. Suspect this will also greatly help with the "not just top or bottom" ZOrdering.

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