Hierarchy question?

0 favourites
From the Asset Store
Logo Quiz with 150 prepared logos and answers, automatic question and answer mixing
  • I have attached a hand to a body, with the body as the parent. Now, I have attached the palm to the hand, now the hand is the parent. The game logic is that when the hand size increases, the palm repositions itself to the appropriate area on the hand, (Nothing fancy going on, I have attached the hand to a body and palm to the hand, that's all)

    as shown in the image below.

    Now, coming to the issue part, Originally the palm was a perfect circle, but As you see in the below image, the palm-size is distorted when the size of the hand increases

    To fix this, I have unselected the transform width, but the palm sprite not honoring its parent's XY position.

    Obviously, we always set the size of the palm fixed on every tic, but can we achieve this using the hierarchy itself?

    Here is the test C3p for reference.

    Tagged:

  • In this particular case you will probably need to use Pin behavior to pin the hand to image point on the arm. Or update its position on every tick with events.

  • Thanks, Initially I tried with PIN, but dropped it because of couldn't figure out, how to make it work with the multiple instances without cloning

    Means,

    When the user click the spawn button, all the required object is created, After that, I set in every tick that it should Pinned to the respected position. But the problem occurs when the user hits the spawn button again, the pin only attached to the firstly spawn object only.

    Please check this new test c3p, and try to click the spawn button multiple times, you will know what issue I'm talking about.

    I tried with "For each" but couldn't figure it out.

  • You can still use the hierarchy to create all objects. And once created, pin the hand to the arm.

  • You can still use the hierarchy to create all objects. And once created, pin the hand to the arm.

    Thanks for the suggestion. I often find myself in this situation in various contexts

    When the user click the spawn button, all the required object is created, After that, I set in every tick that it should Pinned to the respected position. But the problem occurs when the user hits the spawn button again, the pin only attached to the firstly spawn object only.

    I want to know how to accomplish that. It would be great if you could guide me on how to do this without using Hierarchy at all, just the shake of learning.

  • But the problem occurs when the user hits the spawn button again, the pin only attached to the firstly spawn object only.

    When you spawn an object, in a sub-event pick its arm and hand using "Pick child" condition.

  • When you spawn an object, in a sub-event pick its arm and hand using "Pick child" condition.

    Could you be more elaborate? I'm using the function to spawn the obj.

  • Basically, I want to know how to PIN when creating or spawning an object.

    I got a post, where a user suggested

    On created, there is an action of Pin.

    Set to the wanted position and Pin to the object that you need.

    But couldn't figure it out yet.

    Please Help.

  • You don't have to spawn body parts, they are created automatically when you create the body, because you have "create hierarchy=true". And you only need to pin once, not on every tick.

    Try this:

  • Now I know where I made the mistake, Thank you so much.

  • In this particular case you will probably need to use Pin behavior to pin the hand to image point on the arm. Or update its position on every tick with events.

    I wish there was an option in the Hierarchy for this particular requirement. But maybe in the future, we might see one.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If I may, could you please assist me with this

    construct.net/en/forum/construct-3/how-do-i-8/export-screenshot-ensure-size-178522

  • Hi dop2000 one doubt about picking children, is there any way we can pick every child under a parent,

    If I hit any button, let's say to rotate or increase the size of the hand it affects every instance of the object, so I added

    + Body: Is iv_Body_IsSelected (Boolean)
    + Body: Pick All children LeftHand
    

    This way it is limited to the highlighted objects only where the Body_IsSelected Boolean is true and it works perfectly.

    Coming to the question, I'm searching for a way to do it efficiently,

    currently, I'm doing like this

    + Body: Pick All children LeftHand
    
    + Body: Pick All children RightHand
    

    The RightHand and LeftHand are the children of the Body, if there is a way we can pick every child under a parent, it will be much simpler.

    For e.g.

    (But unfortunately, there is no such option. this modified screenshots I put to convey my point visually)

    The code is (please check below) not that lengthy as of now, but once many components are added later it becomes complex because every time we have to pick the specific children. Or is there any other way to make it efficient by using IID or family?

    Here is the code.

  • I believe what you are looking for is families. You can add all body parts to a family and use "Body pick all BodyPartsFamily".

  • Actually, I tried this way, but it not working, maybe I'm doing it wrong?

    Here is the test c3p.

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