How do I give priority to one animation? Lossing my mind!

Get help using Construct 2

Post » Fri Aug 26, 2016 6:14 pm

Hello.

I'm lossing my mind trying to find a fix for this issue. Here's the problem:

I want to set a "TakeHit" animation whenever I call the funcion TakeHit, which subtracts 1 from HP and sets the player flashing. If I just add the set animation to "takehit" on the function it wont do anything because other animation events are not allowin this to happen.

Animations events are a few such as platform is on floor and not moving set to idle, if moving set to run. if falling to fall, if jumping to jump and so on.

I added the condition not flashing to the idle animation events and it worked just for that one but it doesnt work with others.

Then I tried to add an event like if player is flashing set animation to takehit and it does work but it just plays the frame 0 somehow and it wont play the full animation.

Is there any possible fix for this?

Thanks
B
14
S
5
Posts: 248
Reputation: 1,705

Post » Fri Aug 26, 2016 6:32 pm

It will be hard to diagnose your issue without seeing your events.

I have a few ideas for you though. Firstly, if it is a simple flash, you don't need to use an animation, you could just adjust opacity from 0-100 a few times really quick.

Second, you can use If-Else chains to signify priority. Else events will only run if the previous one did not.
Mistakes were made.
B
52
S
26
G
108
Posts: 1,606
Reputation: 61,133

Post » Fri Aug 26, 2016 6:52 pm

oosyrag wrote:It will be hard to diagnose your issue without seeing your events.

I have a few ideas for you though. Firstly, if it is a simple flash, you don't need to use an animation, you could just adjust opacity from 0-100 a few times really quick.

Second, you can use If-Else chains to signify priority. Else events will only run if the previous one did not.


Else won't do the work for what I've seen from my tests.

About the opacity won't do the work I really want to play the animation because my character is flubberlike so whenever it takes hit it decompose into small particles and becomes one again. So it is so important to play the takehit animation whenever I call the function takehit.
B
14
S
5
Posts: 248
Reputation: 1,705

Post » Fri Aug 26, 2016 7:03 pm

Nevermind. I think I fixed it!

Thanks anyway
B
14
S
5
Posts: 248
Reputation: 1,705

Post » Fri Aug 26, 2016 7:06 pm

Then I tried to add an event like if player is flashing set animation to takehit and it does work but it just plays the frame 0 somehow and it wont play the full animation.

I suppose player is flashing for some time. Meaning 'if playing is flashing' will be true many ticks. Each tick that it is true, the animation gets set to play from the beginning. So each tick the animation starts (and shows) frame zero.

Add a system > 'once while true' to the event containing 'if player is flashing'. I suppose you set controls to off while flashing. Thats why the 'idle' kept kicking in. And you do need to cage that 'idle' as you do.
If you dont set the controlls to off (player can keep moving) then you will have indeed to cage all other animation controls same way.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Aug 26, 2016 7:10 pm

I dont understand how your 'idle' can play.

If you do 'as platform is on floor and not moving' set to idle ....

The two conditions that try to catch that, are always true, unless there is action taken. (an action like moving the player) If you dont use 'once while true', also the idle should not play (unless it is only 1 frame).
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Aug 26, 2016 7:56 pm

99Instances2Go wrote:I dont understand how your 'idle' can play.

If you do 'as platform is on floor and not moving' set to idle ....

The two conditions that try to catch that, are always true, unless there is action taken. (an action like moving the player) If you dont use 'once while true', also the idle should not play (unless it is only 1 frame).


> Platform is on floor

(subevent) Platform is moving - Set Run
(subevent) Platform is not moving - Set Idle

Works perfect for me.
B
14
S
5
Posts: 248
Reputation: 1,705

Post » Fri Aug 26, 2016 8:52 pm

Okay, i learned something new. Thank you for pushing my dumb nose on it.

I learned: Construct will only set the animation if the new animation is not allready the current animation, or when the current animation stopped playing.

Wish someone told me that before.

So in your case, the animation "takehit" not playing means that there was another animation playing than "takehit". Lets call it "Mystery".
So next tick "Mystery" got set playing again and in the same tick also "takehit". Over and over again.

So ive been talking bullshit a while now about animations, and i never got corrected. I appologize for all misinformation all above posts.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Aug 26, 2016 9:05 pm

Any way. Post you capx and promiss to fix it, in return.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to How do I....?

Who is online

Users browsing this forum: ST314 and 28 guests