How do I stop an animation while another one is playing?

Get help using Construct 2

Post » Sat Apr 26, 2014 5:03 pm

Hello all, I was wondering, how do I stop an animation while another one is already playing? For example, in my code below, when the player releases any of the buttons, the animation will revert back to "shoot" (which is what I want), but, how do I make an exception saying that if the 'Character' collides with a specific object, it will play "characterStarAnim" (another character animation) instead of automatically reverting back to the "shoot" animation?

Image
Image

Thanks,
guannstar (FNORD)
B
28
S
5
G
1
Posts: 594
Reputation: 3,286

Post » Sat Apr 26, 2014 5:22 pm

Hello,

Perhaps adding the "Character > On collision with spellBook" beneath Touch > On any touch end as a sub event and adding an else (else to the Character on collision with spellBook) to run the shoot.

It would look like this:
Touch > On any touch end
.... Charachter > On collision with spellBook -- Destroy and Set animation to "characterStarAnim"
.... Else -- -- Set animation to "shoot"

I think that should do the trick for you.

Hope that helps.
B
19
S
7
Posts: 161
Reputation: 1,751

Post » Sat Apr 26, 2014 5:26 pm

OK, I'll try that and get back to you. Thanks a lot for the help:)
B
28
S
5
G
1
Posts: 594
Reputation: 3,286

Post » Sat Apr 26, 2014 8:24 pm

OK, hey @Vallar, I tried what you said, but it's still not working. As you can see below, the sub-event will not allow any object ("Character") to collide with another object ("spellBook"). Instead, I had to use 'Is overlapping', and now it wont work at all. How do I get it so that it's ("Character") able to collide with other objects?

Image
B
28
S
5
G
1
Posts: 594
Reputation: 3,286

Post » Sat Apr 26, 2014 8:34 pm

I think it might be that the On Touch end still has an action. I believe if you delete that it might work. Is it possible that you try with deleting the action next to Touch > On any touch end + changing back to collision rather than overlapping?

If not, the next best thing I could think of is the original setup you had; but instead of doing it exactly the same, I would add another condition to the "Collision" which is "On touch end" if that is what you want (that the animation would play when the touch end and the character collides with that spellBook).
B
19
S
7
Posts: 161
Reputation: 1,751

Post » Sat Apr 26, 2014 10:05 pm

Hey @Vallar, I've tried both of those solution, but none of them have worked:( I don't get it, this seems like such a simple problem, but apparently, it's not lol. I've converted my code back to the way it originally was (in my first post). Can somebody please help me out with this? ...Thanks.
B
28
S
5
G
1
Posts: 594
Reputation: 3,286

Post » Sat Apr 26, 2014 11:39 pm

guannstar wrote:Hello all, I was wondering, how do I stop an animation while another one is already playing? For example, in my code below, when the player releases any of the buttons, the animation will revert back to "shoot" (which is what I want), but, how do I make an exception saying that if the 'Character' collides with a specific object, it will play "characterStarAnim" (another character animation) instead of automatically reverting back to the "shoot" animation?

Image
Image

Thanks,
guannstar (FNORD)


Add an other condition to the event with the "on any touch end":
- animation characterStarAnim is not playing (invert the is playing).

That will hopefully prevent the "shoot" animation to trigger while the "characterStarAnim " is playing.
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649

Post » Sun Apr 27, 2014 2:13 am

Hey @eli0s. It only allows you to do 'Is playing'. How do you invert the 'is playing' when adding another condition?
B
28
S
5
G
1
Posts: 594
Reputation: 3,286

Post » Sun Apr 27, 2014 3:37 am

Hey guys, sorry, I really need some help here:( Can somebody please help me?
B
28
S
5
G
1
Posts: 594
Reputation: 3,286

Post » Sun Apr 27, 2014 5:35 am

Bump:(
B
28
S
5
G
1
Posts: 594
Reputation: 3,286

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 12 guests