touch problem

Discussion and feedback on Construct 2

Post » Sat Dec 07, 2013 11:20 am

i have a sprite that i use to be like a checkbox.
so i give that sprite variable instance "selected" wich means value=1 if selected and value=0 if not.

if the selected=0 the animation set "Default".
if the selected=1 the animation set "Selected".

when I touch/click the sprite, I set variable "selected=1", and animation turn to "Selected". But when I try to clicked it again, the sprite wouldn't turn back to "Default" animation.

anyone can help me?
B
2
Posts: 2
Reputation: 154

Post » Sat Dec 07, 2013 11:37 am

You should post a .capx or a screenshot of your code.

You may have the check for touch events happening one after the other which would happen in the same tick, thus negating the objective.

Better to either use a variable to keep track of which option is touched, or use 'else'.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
86
Posts: 5,422
Reputation: 59,530

Post » Sat Dec 07, 2013 12:46 pm

sometimes putting a "Wait" in the second Event will cause it to wait til the next tick, solving the problem. But it depends on how yours is setup.
B
233
S
62
G
33
Posts: 902
Reputation: 40,398

Post » Sat Dec 07, 2013 4:03 pm

wow! it's work! thank you :D
B
2
Posts: 2
Reputation: 154


Return to Construct 2 General

Who is online

Users browsing this forum: mihirolover and 12 guests