... using modulo with buttons?

Get help using Construct 2

Post » Mon Dec 31, 2012 8:10 pm

Hi there,

So another big question that i'm struggling with is how to handle toggle buttons. The general idea to me is that i would love to touch an object and have it spawn the "ON" button and destroy itself.. triggering some kind of variable change to let other game mechanics know the button has "armed" the game.

The thing i ran into before with GameSalad was putting these two objects over each other of course created rapid ON/OFF/ON/OFF as the touch action would be perpetually touching the next version making the idea of a toggle button pretty useless.

The solution I was taught was the use of modulo(modular) math. this circumvented the problem of the touch action creating the instant other condition.

In Construct 2, when I do this, i don't even get a flicker. I just get nothing. I can get a button to turn "ON" but the subsequent "OFF" action is eluding me so far.

Thanks!
Caleb
B
51
S
7
G
1
Posts: 869
Reputation: 5,943

Post » Mon Dec 31, 2012 9:15 pm

I believe this is what you're after..

https://dl.dropbox.com/u/666574/on%20off%20button.capx
B
15
S
5
G
7
Posts: 877
Reputation: 5,650

Post » Tue Jan 01, 2013 3:48 am

you got it! :) that is perfect!   happy new years!

Thanks!
Caleb
B
51
S
7
G
1
Posts: 869
Reputation: 5,943


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 26 guests