Toggle Button

Get help using Construct 2

Post » Sat Oct 20, 2012 10:44 pm

What's the best way to do a toggle button? My method doesn't seem to work:

Click the button.
Move the button off screen.
Move the new toggle button (which had been off screen) in to it's place.
Do an action (eg silent audio)

Should that work?
B
19
S
3
G
2
Posts: 212
Reputation: 4,011

Post » Sun Oct 21, 2012 1:29 am

Use layers.

Click the button | Hide Layer 1
                 | (Action)
                 | Show layer 2
B
18
S
9
G
5
Posts: 77
Reputation: 4,946

Post » Sun Oct 21, 2012 2:08 am

Good idea. I guess it's time to upgrade. Thanks!
B
19
S
3
G
2
Posts: 212
Reputation: 4,011

Post » Wed Oct 24, 2012 1:10 pm

@kenhes

I think you have layers in the free version.
B
18
S
9
G
5
Posts: 77
Reputation: 4,946

Post » Wed Oct 24, 2012 2:17 pm

[QUOTE=lonehangman] @kenhes

I think you have layers in the free version.[/QUOTE]

There are...but only four and I'm using them all already.
B
19
S
3
G
2
Posts: 212
Reputation: 4,011

Post » Wed Oct 24, 2012 3:28 pm

Take a Sprite and build each "toggle" state a one frame of the animation. Then simply step through the frames.
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Thu Oct 25, 2012 2:09 am

@Weishaupt So something like this? When touched/clicked, it goes to frame 1, but going back to frame 0 doesn't work.

B
19
S
3
G
2
Posts: 212
Reputation: 4,011

Post » Thu Oct 25, 2012 10:21 am

If you use just one boolean it should work.

Since you did not post your capx, I can not fix it for you
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Thu Oct 25, 2012 11:16 am

As Weishaupt said, use only a single boolean (for example "back")
Make event 7 a condition "System: else" (no boolean check)

Since you are changing the value of back in event 6, in your current code, event 7 also executes, changing again the values making it look like it's not working, when in fact both events are executed in a row.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Thu Oct 25, 2012 11:59 am

Thank you guys! I didn't even know where to find the "else". It works great now. I can toggle all my buttons!
B
19
S
3
G
2
Posts: 212
Reputation: 4,011

Next

Return to How do I....?

Who is online

Users browsing this forum: LaroTaio and 2 guests

cron