OR, IF, ELSEIF, ELSE, WHILE, etc

Get help using Construct 2

Post » Wed Jan 25, 2012 5:47 pm

@ranma: dld again the previous capx.
I cheated using opacity.
It is a good question though, using the visible property with a conditionnal operator.
I'm not sure it can be done. If it can, I'd love to know how to.

For that one though, there's a trick/workaround to use a temp variable.
The code you first gave would look like :

[code]on touch end
-- object is visible?
-- tVar = 0
++++ make object invisible
++++ tVar = 1
-- object is invisible?
-- tvar = 0
++++ make object visible
++++ tVar = 1
[/code]

This stops the "looping" effect.Kyatric2012-01-25 17:49:13
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 » Wed Jan 25, 2012 6:03 pm

[QUOTE=Kyatric] @ranma: dld again the previous capx.
I cheated using opacity.
It is a good question though, using the visible property with a conditionnal operator.
I'm not sure it can be done. If it can, I'd love to know how to.

For that one though, there's a trick/workaround to use a temp variable.
The code you first gave would look like :

[code]on touch end
-- object is visible?
-- tVar = 0
++++ make object invisible
++++ tVar = 1
-- object is invisible?
-- tvar = 0
++++ make object visible
++++ tVar = 1
[/code]

This stops the "looping" effect.[/QUOTE]

great, here's the exact code that worked, has to be inside a group as local variables can only be applied inside groups:

[code]
-----------------
group: clicking
-----------------
local number clickloop = 0

on touch end: clickloop = 0
-- object is visible?
-- clickloop == 0?
++++ make object invisible
++++ set clickloop = 1
-- object is NOT visible?
-- clickloop == 0?
++++ make object visible
++++ set clickloop = 1
[/code]

hope it helps someone, thanks Kyatric
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 0 guests