A simple animation toggle

Get help using Construct 2

Post » Mon May 06, 2013 5:43 am

I have this sprite which has 2 animations - Default and UnMusic

I have a global variable that says "IsMusic" set to 1 by default


This is what I'm doing



The "IsMusic" is becoming 0 when touched the first time, but the animation doesnt change.


Anyone knows the reason?
Krish
Hey! Did you know that you can hire me to make your games?

Click Here to See More
B
21
S
6
G
5
Posts: 391
Reputation: 5,627

Post » Mon May 06, 2013 6:11 am

The first event toggles it to 0, activating the second event as well. Put both 'isMusic' checks under the same 'on touch' events, and use 'else' on the second one.
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Mon May 06, 2013 7:30 am

> Put both 'isMusic' checks under the same 'on touch'

That seems to do the same thing, unless I move the zero check first I think :) (because of top down order of reading it)

So better to use an "else"


Thank you :D
Krish
Hey! Did you know that you can hire me to make your games?

Click Here to See More
B
21
S
6
G
5
Posts: 391
Reputation: 5,627

Post » Mon May 06, 2013 8:31 am

[QUOTE=krish] > Put both 'isMusic' checks under the same 'on touch'

That seems to do the same thing, unless I move the zero check first I think :) (because of top down order of reading it)

So better to use an "else"


Thank you :D[/QUOTE]

onTouch
.. if isMusic = 0
... Do stuff
..else
... Do other stuff

Should work :)
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Wed May 08, 2013 10:13 am

[QUOTE]onTouch
.. if isMusic = 0
... Do stuff
..else
... Do other stuff
[/QUOTE]

yeah thats what I did after your first reply :) .. was just saying that if A
do stuff
if B
do stuff

doesnt work. :)
Krish
Hey! Did you know that you can hire me to make your games?

Click Here to See More
B
21
S
6
G
5
Posts: 391
Reputation: 5,627


Return to How do I....?

Who is online

Users browsing this forum: Kagubro, Yahoo [Bot] and 22 guests