How do I make all other buttons off when i click one of them

Just started using Construct 2? Post your questions here

Post » Wed Sep 07, 2016 6:24 pm

Hello!
I have one really nooby question. I guess it's very simple but i really don't know how to implement it. I have 7 buttons on my interface, added to a family called "DressButtons". I want when i click on one of them to turn off all other buttons. So when user click on Button 1 and then click on Button 2 i want to Button 1 be turned off. Right now i have to click same button again in order to turn it off.

This is my current event sheet:
Image

I have tried picking all instances with this boolean enabled, but it's turning off previous and current button that i have pressed.
B
14
S
3
G
1
Posts: 95
Reputation: 1,015

Post » Wed Sep 07, 2016 7:19 pm

On touched makes a picklist containing that 1 button that is touched.
When that (and only that) button is touched before ... pressed is toggled off for that and only that button.
Else that (and only that) button ... pressed is toggled on for that and only that button.

Since the picklist contains 1 button, you dont reach the other buttons.

Just add the function plugin to the project.
A function starts picking from scratch.

So ...
Condition ..
On touched Dressbuttons
Actions ..
Call function "unpress"
disable effect
set width to 40
set boolean pressed to true (dont toggle)

Condition ..
On function "unpress"
Actions
Pick all Dressbuttons
enable effect
set widt to 200
set boolean pressed to false
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Sep 07, 2016 7:27 pm

Thanks! This worked!
I just found one error in this code, but i fixed it!
On touched Dressbuttons action need to enable effect and Function need to disable it :D
B
14
S
3
G
1
Posts: 95
Reputation: 1,015


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests