Hide/show a group of sprites - including textbox

Get help using Construct 2

Post » Wed Mar 20, 2013 8:33 pm

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!
B
12
S
2
G
3
Posts: 86
Reputation: 2,955

Post » Wed Mar 20, 2013 10:26 pm

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
B
40
S
12
G
7
Posts: 603
Reputation: 7,656

Post » Thu Mar 21, 2013 8:03 am

Ahh thanks @EncryptedCow, so toggling visibility is the wrong way of looking at it, I should be moving the box on/off screen!
B
12
S
2
G
3
Posts: 86
Reputation: 2,955

Post » Thu Mar 21, 2013 8:08 am

[QUOTE=onion]toggling visibility is the wrong way of looking at it, I should be moving the box on/off screen! [/QUOTE]

Not necessarily, depends on what kind of effect you want. You should also look into containers, they make controlling composites of objects 100% easier :)
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Thu Mar 21, 2013 9:01 am

I just read up about containers. I actually think that's a much neater solution than pinning, and will experiment with that. Thanksonion2013-03-21 09:01:50
B
12
S
2
G
3
Posts: 86
Reputation: 2,955

Post » Thu Mar 21, 2013 9:29 am

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.
B
56
S
15
G
10
Posts: 910
Reputation: 11,952

Post » Thu Mar 21, 2013 9:37 am

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?
B
12
S
2
G
3
Posts: 86
Reputation: 2,955

Post » Thu Mar 21, 2013 10:10 am

[QUOTE=onion] 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? [/QUOTE]

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. :)
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Thu Mar 21, 2013 6:39 pm

Ahh right, that'll be okay actually. It might be easier when I have multiple stuff I need to hide/show
B
12
S
2
G
3
Posts: 86
Reputation: 2,955


Return to How do I....?

Who is online

Users browsing this forum: austinblackbelt, mallorcaredes, ultrafop and 3 guests