How do I pick the scale? (replicas)

0 favourites
  • 5 posts
From the Asset Store
Pick Up Items Sounds
$3 USD
50% off
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • Hello!

    I have some characters based on a template. When I start the layout I load the config from the Json and call a function that changes the sprites to the frame, size and color I want.

    I have 3 sizes: Adult, Kid and baby. For the baby, additionaly to the sizing I wanted to modify the scale of the arms and head.

    this is the intended result.

    The problem I found is that when I try to load it by the condition for the body scale (since the condition doesn't exist I stored it as a var) It affects all the bodies, not just the "baby". I only could make it work by a trigger like 'on drag' or "on drop" but not in the normal loading where it should be :/

    Any ideas on how to trigger this?

  • Looks like you are not using hierarchies properly. You can set "transform width/height" for all children in a hierarchy. Then when you change the scale of the parent object, all children will be scaled automatically with it.

    You also don't need to link parts of the hierarchy with instance variables. If collider_char is the parent object, to pick its head you simply use "collider_char Pick Children Head" condition.

    You can create a family called Limbs for all arms/legs sprites. Then the code may look like this:

    if Body Scale=0.5
    Body pick children Limbs : Limbs set scale to 0.7
    
    
  • Looks like you are not using hierarchies properly. You can set "transform width/height" for all children in a hierarchy. Then when you change the scale of the parent object, all children will be scaled automatically with it.

    You also don't need to link parts of the hierarchy with instance variables. If collider_char is the parent object, to pick its head you simply use "collider_char Pick Children Head" condition.

    You can create a family called Limbs for all arms/legs sprites. Then the code may look like this:

    > if Body Scale=0.5
    Body pick children Limbs : Limbs set scale to 0.7
    
    

    Thank you for replying!

    Looks like you are not using hierarchies properly. You can set "transform width/height" for all children in a hierarchy. Then when you change the scale of the parent object, all children will be scaled automatically with it.

    I'm not sure I get this! I do have "transform width/height" ticked and they are scaling correctly. I scale the body and then everything scales acordingly. It's only that when I have the "baby size" (0.5), I don't want the head and the arms to scale to 0.5 but 0.7.to give the chibi look.

    I want to do this only for baby characters in the loading stage. But when I try to add at the end of 'on start layout' it does nothing. If I add it a single trigger it does affect all the bodies, regardless thir escale.

    I could only make it work when 'on drag', but i need it to happen before you interact with the character.

  • Where do you get the value from JSON and set the scale to the body? Is it in "On Start of layout" event? Then change the scale of baby arms/legs in the same event.

    You are either doing this before the hierarchy is created, or on every tick, it's not clear from your screenshots. There is no point in updating the scale on every tick.

    Also, like I said, use "Pick children" instead of picking by Member variable. It's possible that the variable is not yet set or set incorrectly, that's why it's not working.

    Try "Body pick children" and if this doesn't work, please post a screenshot of the event sheet showing all relevant events.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Where do you get the value from JSON and set the scale to the body? Is it in "On Start of layout" event? Then change the scale of baby arms/legs in the same event.

    You are either doing this before the hierarchy is created, or on every tick, it's not clear from your screenshots. There is no point in updating the scale on every tick.

    Also, like I said, use "Pick children" instead of picking by Member variable. It's possible that the variable is not yet set or set incorrectly, that's why it's not working.

    Try "Body pick children" and if this doesn't work, please post a screenshot of the event sheet showing all relevant events.

    I made it work with pick children! :3 Thank you for your help!!! you rock!

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