0 Favourites

Hide/show a group of sprites - including textbox

  • Hi guys, I'm still working through my very first project and need some advice. I've got a dialog box which needs to be shown/hidden on a key press, and this dialog box includes a textbox. Obviously I could use separate events to hide show the dialog and the textbox separately, but I wondered if there's a way to group several objects into one object, so I can show/hide them with just one expression?

    Thanks!

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • You could pin all the objects to a single box, then when you want it to show put the box in place and when you need it top pop out, put that box off screen

  • Ahh thanks EncryptedCow, so toggling visibility is the wrong way of looking at it, I should be moving the box on/off screen!

  • toggling visibility is the wrong way of looking at it, I should be moving the box on/off screen!

    Not necessarily, depends on what kind of effect you want. You should also look into containers, they make controlling composites of objects 100% easier :)

  • I just read up about containers. I actually think that's a much neater solution than pinning, and will experiment with that. Thanks

  • Don't forget that objects off-screen or invisible can still be interacted with. You should use another condition like "is visible" or "is on screen" to check if the dialogue box should be interactive or not.

  • Hold on... toggling visibility doesn't apply to the other container objects, so this works differently to how I expected. I still have to toggle visibility on all objects separately?

    I've got a container with text and bounding box, and I'm toggling visibility with a keypress, but I still have to toggle visibility on each objects independently, even though they're in a container?

  • Hold on... toggling visibility doesn't apply to the other container objects, so this works differently to how I expected. I still have to toggle visibility on all objects separately?

    I've got a container with text and bounding box, and I'm toggling visibility with a keypress, but I still have to toggle visibility on each objects independently, even though they're in a container?

    1) Yes, you'll have to still do it separately. What it does is it creates/destroys/picks objects in same container.

    2) You could put all the objects in separate layer and hide the layer on key press, that way you would not have to worry about anything really. :)

  • Ahh right, that'll be okay actually. It might be easier when I have multiple stuff I need to hide/show

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