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

0 favourites
  • 9 posts
From the Asset Store
A set of board games to make your day joyful. Play, Enjoy, Relax
  • 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

  • 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.

  • 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.

  • Nevermind. I think I fixed it!

    Thanks anyway

  • 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.

  • 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).

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • Any way. Post you capx and promiss to fix it, in return.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)