On / Off Button Problem :s

Get help using Construct 2

Post » Sun May 13, 2012 4:29 pm

ohh i forgot to remove that, soz
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Sun May 13, 2012 4:35 pm

Thx you two :)

Could you perhaps explain a bit? So that it gets stuck in my head

@vtrix        grid = 0?1 :0

@newt          Sprite.var%2=0 ?100 :50

I mean.. I get it.. but I did not know the syntax
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Sun May 13, 2012 5:05 pm

Guide to Construct 2's event features

See the section on 'Else', and why it fixes events like you've set up.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Sun May 13, 2012 5:27 pm

% or modulo returns the remainder from division so variable%2 would be the remainder of the variable divided by 2. Then as you know, any even number divided by 2 has a remainder of 0, since they are all divisible by 2. That also means any odd number will not be 0.

? : are conditionals. If you do a comparison, like 1=1, the system will take the question mark to mean that anything after ? is to be taken when the condition is true. Then anything after : is to be used if it was false. so 12%2=0 would give you 0 as a remainder, and be true.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Sun May 13, 2012 6:37 pm

@Ashley Very Insightful Ty :)

@Newt Ah! :D Ty, I'm glad that we are able to use math in C2 if we choose too

B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Sat May 24, 2014 6:06 pm

Hello got a trouble about 2 states sprite button (switch).
If I move button_1 to bot layer to make the button_2 at top the mouseclick is still affected at the button_1
if I make button_1 invisible and make button_2 visible the mouseclick does'nt work too in all ways the button_2 is not affected by any click because the button_1 is logicaly always present.
Tried destroy or move outside the layout but fail.
Any idea about this?
'mega.co.nz/#!4h9yjKKR!CddgGZVB0-eyT7mI0jOYSIIuKATLB7fLpW7dy0MRrAM'
(switch_fail.capx)
B
4
Posts: 10
Reputation: 222

Previous

Return to How do I....?

Who is online

Users browsing this forum: austinblackbelt and 13 guests