Fade Behavior acting strangely?

0 favourites
  • 12 posts
  • Hi!

    I've been having this issue with a boss in my game. I have it set so that when the animation is close to ending, the fade behavior begins for a very specific effect. However, I have found that when the Boss is in a specific phase, it ignores this entirely and starts the fade effect at the beginning of the animation. Here are only only events in my project that affect the fade behavior.

    As you can see, I used the browser to confirm that the fade was indeed started at the beginning of the animation. I had to do this because for whatever reason, when this is happening this object in particular ignores the time scale completely. I tried to lower the time scale to see more clearly, but this was the only object that acted as normal. I have not used any event that alter this object's time scale, so I have no idea what could be causing this.

    I have also used the browser to confirm that this is the event that triggers it. No other events have an affect on this. I am not sure how to solve this. Is it a bug?

    Thank you for your time.

  • The logic looks okay so it's only guess work without the file. Two things spring to mind. Are you spawning the boss object at the time you set that animation because the fade will start automatically on object creation unless disabled. Another cause might be the picking and you are referencing another boss object that exists and is playing the death animation.

  • The logic looks okay so it's only guess work without the file. Two things spring to mind. Are you spawning the boss object at the time you set that animation because the fade will start automatically on object creation unless disabled. Another cause might be the picking and you are referencing another boss object that exists and is playing the death animation.

    Thanks for the reply.

    This triggers when you defeat the boss, so this is a bit after spawning and I have it set to not start upon spawning. There is also only one boss object, so it shouldn't be an issue-- but I can try making the picking more specific just in case.

  • When you start "death" animation, do you start it from the beginning or from current frame? It may be possible that when the "alive" animation is on frame>15 and you switch to "death" animation from the current frame, that's when it triggers the Fade, and then "death" animation restarts from the beginning.

    Add another "Browser Log" to the event where you start Fade, it may help to understand the issue.

  • The above makes sense, you didn't show us where you set the animation. If it's not that then share the file!

  • When you start "death" animation, do you start it from the beginning or from current frame? It may be possible that when the "alive" animation is on frame>15 and you switch to "death" animation from the current frame, that's when it triggers the Fade, and then "death" animation restarts from the beginning.

    Add another "Browser Log" to the event where you start Fade, it may help to understand the issue.

    I start the Death Animation at the beginning, although I considered that too. The log in the first image I posted was mainly used to indicate which frame the animation was starting at and when the fade behavior was starting-- basically showing it starts to fade as soon as it switches to the death animation regardless of frame. This only happens when the Boss goes from "Phase C" animation to "Transition between Phase C and A" animation to the "Death Animation," which is odd.

    The above makes sense, you didn't show us where you set the animation. If it's not that then share the file!

    Here are the two sets of events I use when changing the animations, hopefully this helps.

  • So it happens only when switching to death animation by this event?

    You didn't expand it on the screenshot, so maybe there is something wrong inside of it. Or somewhere else in your code...

    Rename Fade behavior on the boss sprite to a unique name like "FadeDeath" and search for this name in all event sheets.

    If nothing helps, as a workaround you can add an event that will disable Fade behavior on frame 0 of death animation.

  • So it happens only when switching to death animation by this event?

    You didn't expand it on the screenshot, so maybe there is something wrong inside of it. Or somewhere else in your code...

    Rename Fade behavior on the boss sprite to a unique name like "FadeDeath" and search for this name in all event sheets.

    If nothing helps, as a workaround you can add an event that will disable Fade behavior on frame 0 of death animation.

    Oh! Not that event, I mean Transition_CA, which I should have been more clear about. I did what you said and the only event referencing the behavior is the original one, although your idea does seem pretty good!! How do I disable the Fade behavior and re-enable it with events? As far as I can tell you can only do that through C2?

  • How do I disable the Fade behavior

    I meant stop Fade behavior, similar way you start it.

    Is animation "death" playing
    Animation frame=0
    Trigger once
    	Boss Fade stop
    	Boss set opacity to 100
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > How do I disable the Fade behavior

    I meant stop Fade behavior, similar way you start it.

    > Is animation "death" playing
    Animation frame=0
    Trigger once
    	Boss Fade stop
    	Boss set opacity to 100
    

    Um, is that something from Construct 3? Because I'm using Construct 2 and I haven't been able to find that action in the editor or in documentation. Sorry!

  • Oh, I never realized that Fade doesn't have Stop action, sorry..

    You can set Fade wait time to a large number and restart fade, then on frame 15 set wait time to 0 and restart it again.

    Or you can use LiteTween behavior instead of Fade, you can definitely stop it. Maybe with LiteTween you will not have this issue at all.

  • I figured out a while back that fade and text fields were both issues when exporting Construct 2 games with Construct 3 runtime, so I replaced text fields with sprite fonts, trashed fade behavior and created my own fade.

    Global or instance variable fade = 0

    When you need to trigger fade set it to 1

    Then just have and event if fade = 1 and sprite .Opacity <100 then sprite.Opacity = Self.Opacity+1

    May help you, may be simpler than trying out to figure out what is going on.

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