Container without Pin behavior (?)

0 favourites
  • 11 posts
From the Asset Store
Wall Pin Board is a hyper causal game developed for fun and inspired by YouTube video whose link is given in description
  • I've read and it gives an example about tanks and turrets, but in fact it doesn't have the expected behavior because if I create a tank I want the turrent to move along with the tank and that does not happens. Am I wrong? I'm using containers for something similar and, when I create the father object (the tank), the child (the turret) is created too but it stays in its place when the father moves.

    If containers works that way, it would be great if the child would move with the father. I think it can be solved with the option "Automatically pin to father when created". I guess this isn't possible right now due to de imposibility to access to the father's son with triggers, events, actions, etc.

    Thank you all! :)

  • Containers are used for picking objects together, you still need to give both objects the action.

    This is useful for when you have conditions that trigger on one or the other, and you want your set of actions to affect only those specific instances that are grouped together in a container.

    For example, if you had an "on collision" type condition with the tank base object, and you had the action make tank turet flash, under normal construct logic all tank turrets on the screen would flash, because no specific instances were picked by the condition. If you had the two in the same container, then the tank turret associated with that tank base would be picked, and the action would apply only to that turret.

    You should still utilize the pin behavior for the effect you are looking for.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Actually I agree with the OP how it should work. Containers shold work like along the lines of a parent -> child model. However it doesn't.

    Container is a collection of objects(that can't share in other containers :( ) that are related to each other. Theoritically when one object in the container get's triggered for use. All the objects in the same version should. however that doesn't seem to happen all that often either.

    For now. Just continue to use PIN. Not the best, but it at least works. C2 does many things great, but it's lack of a Parent/Child and it's simple PIN behaviour are it's weakest points so far :(

    Otherwise fantastic tool :)

  • It's intended that you use the Pin behavior. This means you can have it both ways (either have container objects that move along together, or objects that move freely and independently).

  • But how can I use Pin Behavior if I can't pick the child (turret) when the tank is created?

    I need to access to the child element with events, actions, etc. but after the tank was created...

  • You can pick the child. The way containers work, if one object in the container is picked, then all other objects in the container are picked. So "Spawn base" followed by "Pin turret to base" should work fine.

  • When the base is created, a turret is created as well. Since they are in a container, referencing the turret right after making the base references the specific turret that base spawned with as containers spawn all parts when only one part is created.

    Another way is doing it On Created of either the Base or the Turret, and pin the turret to the base as it will reference that specific turret and that specific base. This way allows you to have multiple things create the base without having you to add "pin turret" to all the actions that spawn a tank.

  • Yiey!

    It works.

    Another question related:

    Is there a way to pick the father if the child triggers some event? for example, sprite B who is the child of sprite C is overlapping sprite X. I need to do something with the sprite C but I don't know how to get to it from its child.

    Thank you guys.

  • Right now I'm doing it with a common instance variable/value for sprite B and C, so I can match father & child but I think it is not the best way...

  • That is the whole point of containers, sprite b and c are always automatically picked together. If sprite B triggers an event, just do an action with sprite C and only the correct sprite c that is linked to sprite B will be affected.

  • oosyrag wow! thank you... I will try it as soon as I get home and tell the results. Thank you very much.

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