Help me to update plugins to support container

0 favourites
  • 9 posts
From the Asset Store
Controller Support ,TouchScreen Support , Keyboard Support , Action Platformer, Lots of Animations
  • Hi, Ashely

    I have a lot of plugins which will set SOL like instance group, please help me to update plugins to support container in r110. Thanks.

    (What's the changing for container?)

    BTW, also please put "AddVariadicParams" into behavior when parsing edittime.js.

  • Ashely

    Is this

    objtype.applySolToContainer();

    correct to do container maintain?

  • Anyone can help to rexrainbow?

    If I know how I help Him but not

    C2 Team???

  • rexrainbow - sorry I missed this thread (you typo'd my name so the forum didn't alert me)

    Your proposed solution is correct, if you modify the SOL for an object, calling objtype.applySolToContainer() will set the corresponding SOLs in the container to have picked the instances corresponding to objtype. However, it's not particularly fast and should only be used in one-off places, like system's Create Object. If it's performance sensitive it gets a lot more complicated, but hopefully that call is enough for all your cases.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ashley

    Uh, sorry, I might typo'd your name many times. <img src="smileys/smiley9.gif" border="0" align="middle" />

    And thanks for the response. I will fix my plugins to support container.

    I found that engine used another code to maintain container in system:create object action.

    // Siblings aren't in instance lists yet, pick them manually
    var i, len, s;
    if (inst.is_contained)
    {
        for (i = 0, len = inst.siblings.length; i < len; i++)
        {
            s = inst.siblings[i];
            sol = s.type.getCurrentSol();
            sol.select_all = false;
            sol.instances.length = 1;
            sol.instances[0] = s;
        }
    }

    Is it the same as

    objtype.applySolToContainer();

    ?

  • rexrainbow - not quite, applySolToContainer() supports all the objects in the SOL whereas system's 'Create object' is setting each SOL to contain a single instance there. I forgot I changed that in a recent build to fix a bug: 'Spawn' and 'Create' specifically have to work around the fact the created instance isn't really created until the next top-level event, so they manually do similar work to what applySolToContainer does. Everywhere else applySolToContainer should be fine though.

  • Ashley

    "Everywhere else applySolToContainer should be fine though"

    Is it including "create object"-like action? I had some actions which will create instances. (or I just follow these code in system:create object)

    And it seems engine will create other instances in the container by

    this.runtime.createInstance(obj, layer, x, y);

    , so that we don't need to create them manually?

  • rexrainbow - if you call createInstance, it will create the other objects in the container, but not pick them. You can't use applySolToContainer after createInstance, since the instance isn't really created until the next top-level event which breaks applySolToContainer. In that case, just copy the code from System's 'Create Object' (if picking works the same way and you just want to pick that one instance).

  • Ashley

    Thanks! I got it.

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