How do I make sprite alternate between animations on click

Just started using Construct 2? Post your questions here

Post » Wed Jan 21, 2015 10:05 am

So, I want to change images of a sprite object on click.
I saved two different pictures as two animations (with one frame each) of the same object.
The code is the following:
animal.PNG


It does not work. It also does not work if I make them frames of one animation and change the frame in the event sheet.
It doesn't matter whether I choose just "tap" or "tap on object", nothing.

Thank you.
You do not have the required permissions to view the files attached to this post.
B
7
S
2
Posts: 68
Reputation: 645

Post » Thu Jan 22, 2015 9:53 am

It doesnt work because the first touch event sets animal to 1 then the second sets it straight back to 0 and so on.
B
47
S
16
G
9
Posts: 1,097
Reputation: 11,180

Post » Sat Jan 24, 2015 2:49 pm

@tavi
Try insert "wait 0.1 or 0.2 second, where I marked for you.
animal-Solution.PNG

Enjoy !
You do not have the required permissions to view the files attached to this post.
B
11
S
1
Posts: 84
Reputation: 1,462

Post » Sat Jan 24, 2015 11:43 pm

Thank you.

It works. But only if I set animal as a global variable instead of local number.

Why would that make any difference in this case?
B
7
S
2
Posts: 68
Reputation: 645

Post » Sun Jan 25, 2015 5:27 am

@tavi
Have you try this in local variable
and don't forget to use @ to tag people or I'll don't know if you are asking ;)
You do not have the required permissions to view the files attached to this post.
B
11
S
1
Posts: 84
Reputation: 1,462

Post » Sun Jan 25, 2015 12:43 pm

@newlee
Thank you!
B
7
S
2
Posts: 68
Reputation: 645


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests