Having issues accessing children

0 favourites
  • 4 posts
From the Asset Store
Add emotion, innocence, joy and cuteness to your video game with these 15 songs and 9 SFX
  • Hey all, I'm just getting started in Construct 3, though I am extremely familiar with programming (C++/C#/Javascript/etc). I'm just learning this low/no code engine for fun.

    I'm creating a button system, and it works perfectly for one button, but the moment I add two buttons, the system breaks. It appears I'm fundamentally not understanding how Construct 3 picks nodes on events. Can someone please take a look at my button event sheet and tell me what I'm doing wrong here?

    Note that I changed Button. to ButtonNormal. and that fixed most of the issues, though the hover+press logic seems to apply to all buttons when it applies to one.

    Tagged:

  • You are adding children to Button family. It should be "ButtonNormal add child ButtonPressed".

    Even if Button and ButtonNormal is the same object, Construct treats the family as a different object in events, allowing to pick family instances independently from object instances.

    Also, the second event should probably look like this:

    Cursor is over ButtonNormal 
    Cursor Left button is down
    .. ButtonNormal pick child ButtonPressed : ButtonPressed set visible
    Else 
    .. ButtonNormal pick child ButtonPressed : ButtonPressed set invisible
    

    And by the way, while hierarchies is an awesome feature in Construct, in this particular case it would be better to use a container instead. Then both objects in a container will exist as a pair, creating one will automatically create another, picking one will pick another and so on.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Maybe I'm missing something, but if I set it to "Cursor is over ButtonNormal", the SpriteFont Set position to function appears to execute on ALL sprite fonts for some reason (putting all labels on the button I'm hovering over). Also, all buttons still react to interactions from any button.

    What do you mean by "ButtonNormal pick child ButtonPressed", what does "pick child" mean here? I don't see that as an option anywhere.

    Sorry for the ignorance!

    [Edit]

    AH I see, it's a condition for some reason. What exactly does "pick child" condition do?

  • Ok I got it working, thanks for the hint!

    For anyone else having this issue.. it appears that you can 'filter' child references by adding them to the condition list for the code block. Everything works perfectly and now I know how to filter out objects. Wonderful!

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