Is this a Container bug or do I not understand Containers?

0 favourites
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • NOTE: "Container" is missing from Tags input at bottom.

    I have several different "Monster" sprites. I want to group together each Monster instance with 1 instance of a few other data arrays. I think Containers are the way to do this.

    I'm seeing what seems like a C3 bug to me, but perhaps I don't understand Containers correctly.

    Steps to recreate:

    1. Any C3 project when several instances of same ojbect "type" that then each need a few other objects grouped with them.

    2. Select one parent object "type", click Create Container

    3. Using Add Object button, add another 2 or 3 objects to group together with this parent object

    4. Now select another instance of this same object "type"

    5. Click Add Object button, to add these same child objects

    6. Notice that you can no longer select these child objects

    I appears that you are not allowed to make multiple Containers with same "type" of parent object with repeated sets of child objects.

    Does this make sense?

    Is this a bug or are Containers not what I should be using to solve my problem?

    Thank you for sharing your C3 expertise! :-)

    Tagged:

  • Not a bug.

    It's not a parent child relationship. It's a partnership.

    One cannot exist without the other.

  • Can you please clarify "one cannot exist without the other"? I understand that a child does not exist without a parent. I understand that a "partnership" implies 2 or more individuals. That's not the Container issue I'm discussing :-)

    Perhaps I'm doing my "Monsters" wrong. Right now I have many uniquely named "Monster" sprites. They share properties (instance vars) on the Monster Family. Is this wrong? Should there be just one spr_Monster that has the shared properties of all Monsters, including a "Name" property. Then I should create many instances of this same spr_Monster and set the unique names and vars?

    EDIT...

    You know I can't do above. Each "Monster" has a unique image. I think I'm doing this correct by created each "Monster" sprite with unique names. Each is a "type" of "Monster". Each is different image with different values in the instance vars. I'm using a Family called "Monster" to store all their same/shared properties.

    Issue is I want to pick one Monster and at same time pick 3 other arrays that hold data specific to that picked Monster instance.

  • Just use a family.

    When using containers:

    When you create one part of the container you automatically create all the other parts.

    When you destroy one part of the container you automatically destroy all the other parts.

    When you pick one part of the container you automatically pick all the other parts.

    Edit:

    If you are using only one frame then you can just use instancing.

    You just have to use instance variables, and other things like IID.

    You can also work this way using animations, although it gets more complicated if you have multiple animations for each character.

  • The Container functionality you just described is exactly what I want. Now refer back to my OP. Thank you for helping me understand :-)

  • You can't add containers to containers.

    There's a logic issue you have to consider.

  • Here is a small snapshot of my objects...

    Sprite "Monster" types. Each with unique image: sprMonsterBlu1, sprMonsterBlu2, sprMOnsterBlu3, sprMonsterRed1, sprMonsterRed2, sprMonsterRed3, and so on, ...

    Each monster above has a unique image.

    Each monster above is in the same "Monster" Family to share one set of all same instance vars.

    Each monster has 3 "child" or "related" or "partner" objects (1 unique UID of each) that I want to create/pick/destroy at exact same time I create/pick/destroy the unique monster UID.

  • You can't add containers to containers.

    There's a logic issue you have to consider.

    I'm not doing this.

    I want a Container that has (this object) as the monster sprite, then 3 other array objects in the Container. Follow? I can do this, but only once. See OP above :-)

  • Other than just replying "no your're wrong..." over and over, can you offer a way to do what I'm trying to do? Or am I not explaining my issue well enough? Thank you for trying to help. I definitely appreciate! :-)

  • The "child" objects have to be unique objects to work in a container.

    Just add more objects to meet the requirements.

    Like you can't put a hat in a container and let them all share the hat.

    If they all have hats you have to add unique hat objects, even if its the same image.

  • The "child" objects have to be unique objects to work in a container.

    Just add more objects to meet the requirements.

    Like you can't put a hat in a container and let them all share the hat.

    If they all have hats you have to add unique hat objects, even if its the same image.

    Ok I get what you're saying but we're not talking about "hats". We're talking about hat "templates" are we not?

    I need to create a sprMonsterBlu1 (its a sprite) and at same time create 3 Arrays that contain data specific to that one instance of sprMonsterBlu1.

    I think this is just something we can't do in C3. I want an instance that has complex instance vars. Not just int, string, bool instance vars. I want instance vars that are arrays of other objects specific to that parent object.

    I thought Containers was the tool I needed, but it seems not. It seems only way is to create "Monster" Family with: Monster.dataArrayA_UID, Monster.dataArrayB_UID, Monster.dataArrayC_UID, then I'm forced to 3, 4, 5 or more repeated picks over and over and over in many different functions to "assemble" my unique Monster instance. This will be a ton of repeated boilerplate.

  • I still feel this is Containers design flaw. I can work around this, by created uniquely named "templates" for each object I want in the container. The flaw is why do the exact same object templates, need unique names in the Containers?

    So now to do what I want with Containers I have to do this...

    Create sets of uniquely named object template sets (to make the Containers) like...

    sprMonsterBlu1 (container, this object)

    --- arrMonsterBlu1ActionChosen (container child)

    --- arrMonsterBlu1ActionSet (container child)

    --- arrMonsterBlu1GridsAdjacent (container child)

    sprMonsterBlu2 (container, this object)

    --- arrMonsterBlu2ActionChosen (container child)

    --- arrMonsterBlu2ActionSet (container child)

    --- arrMonsterBlu2GridsAdjacent (container child)

    sprMonsterBlu3 (container, this object)

    --- arrMonsterBlu3ActionChosen (container child)

    --- arrMonsterBlu3ActionSet (container child)

    --- arrMonsterBlu3GridsAdjacent (container child)

    sprMonsterRed1 (container, this object)

    --- arrMonsterRed1ActionChosen (container child)

    --- arrMonsterRed1ActionSet (container child)

    --- arrMonsterRed1GridsAdjacent (container child)

    sprMonsterRed2 (container, this object)

    --- arrMonsterRed2ActionChosen (container child)

    --- arrMonsterRed2ActionSet (container child)

    --- arrMonsterRed2GridsAdjacent (container child)

    sprMonsterRed3 (container, this object)

    --- arrMonsterRed3ActionChosen (container child)

    --- arrMonsterRed3ActionSet (container child)

    --- arrMonsterRed3GridsAdjacent (container child)

    These are the exact same object templates over and over and over and over with just unique name. Isn't this a Containers design flaw? Why can't Containers do this?...

    sprMonsterBlu3 (container, this object)

    --- arrActionChosen (container child)

    --- arrActionSet (container child)

    --- arrGridsAdjacent (container child)

    sprMonsterRed3 (container, this object)

    --- arrActionChosen (container child)

    --- arrActionSet (container child)

    --- arrGridsAdjacent (container child)

    sprMonsterGrn3 (container, this object)

    --- arrActionChosen (container child)

    --- arrActionSet (container child)

    --- arrGridsAdjacent (container child)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You may be overly complicating things with the multiple arrays.

    In fact I wouldn't use uids at all.

    Ideally you would serialize the associated objects at creation using variables.

    Pick them later via monsterfamily.variable=itemfamily.variable

    If you create them in a loop, use the loopindex as its identifier.

    Items are automatically picked on creation.

    You can assign those ids at creation if you time it correctly.

  • Or...

    Are the Containers designed exactly right (as I'm describing) and the flaw is in the C3 editor UI that doesn't allow me to create the Containers the way it should? So my workaround above gets past the editor bug?

  • See my second and fourth post.

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