Pinball toggle button/pad

Get help using Construct 2

Post » Wed Jan 15, 2014 10:20 pm

I'm working on a pinball game, and at the top I've got the three roll over buttons. Generally, by pressing the left or right flipper you can toggle the ones on to off and vice versa. I'm having some difficulty implementing the switch from the paddle buttons.

The buttons switch properly, on becomes off, off becomes on... But the variable im trying to set with how many are on and off does not change. I've spent the last 10 years scripting in 3d game studio, and I still don't fully understand how construct flows.

toggle1_1 is a global variable
active is an instance variable

B
13
S
4
Posts: 61
Reputation: 1,028

Post » Wed Jan 15, 2014 10:27 pm

Edit

never mind.....

I'm tired and talking bo**ox.....zenox982014-01-15 22:33:45
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
86
Posts: 5,416
Reputation: 59,518

Post » Wed Jan 15, 2014 10:29 pm

Why not use a boolean for the active variable?

and use a for each sprite
sprite is active
add 1 to totalactive
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Jan 15, 2014 10:31 pm

1-variable would work also, it has the same effect as toggle boolean.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Jan 15, 2014 10:42 pm

the 'for each' definitely saved the day. everything seems to be working fine except for the toggle button on the right :( it doesnt seem to want to... toggle. I better put on some coffee. thanks for the help. im sure ill be posting again pretty quick. ill be sure to rip some hair out of my head before i do though.
B
13
S
4
Posts: 61
Reputation: 1,028

Post » Wed Jan 15, 2014 10:51 pm

DOH. It was just the placement of checking if the global variable was 0 (so you cant just flick them all on with the paddle). I just rearranged the events so the check was done before 'for each', and BAM.
B
13
S
4
Posts: 61
Reputation: 1,028


Return to How do I....?

Who is online

Users browsing this forum: blackhornet, Microbex and 17 guests