Layer Opacity Won't Reset

0 favourites
  • 5 posts
  • Hi there,

    My problem is essentially this:

    I created a function that fades to black before switching layouts. It works great, but after coming back to the original layout, the screen is black. After lots of testing and frustration, the problem seems to be that the black layer I created is not reset--the opacity remains 100%, so the black layer covers up the screen. Trying to manually revert while keeping the execution of the fade isn't really possible not to mention kind of silly to do IMO--the layer should get reset if you ask me, though I'm not a very knowledgeable person.

    I could probably fix this by not using a layer, but I'm curious as to why this is the case and how I could fix it, if possible, since it might become troublesome at a later stage.

    EDIT: On a random side-note, how do you move an object out of a folder? Dragging the object onto the up arrow that I use to go up a directory doesn't work.

  • I assume your using a shader effect like "brightness". Reverse the effect On start of layout.

    Also try using the effect on layout instead of the layout. I've had the same issues. You need run the values in reverse on start of layout. They don't reset after leaving layout.

    Take a look at this example

    In the future you need to be more specific about how your accomplish your effect or post a capx.

    Hope this helps

  • Sorry, no, I'm not using any real effects (using canvas2d renderer, not WebGL).

    [quote:192l6tls]Also try using the effect on layout instead of the layout.

    What do you mean by this?

    Sorry for the lack of information/explanation, due to the nature of the project I also can't post any files but I'll try to elaborate more in the future.

  • I posted an example of what I mean by this. If your not using effects C2 effects, your going to have to give some info or an example of how you accomplished this. Either post some screen shots with a detailed explanation or create a separate capx with a sample of your issue.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well I fixed it using a sprite object instead, but what I did was:

    • For "layout 1", I created a layer at the top of the layer list called "BlackFade" that was a layer consisting of a black background with an opacity of 0
    • Ran a code that increased the opacity over time from 0 to 100, giving a fade-to-black effect

    This part worked fine.

    • I then went to the next layout, which we can call "layout 2"
    • On that layout, I pressed a button to go BACK to the original layout
    • Upon doing so, the layer was still black as if though it had never restored the original opacity value of the layer, which after some testing, seems to have actually been the case.

    I can't reset the opacity to 0 at the end of the fade or it will show the original screen for a split-second, and I can't reset a layer on layout 1 while I'm currently on layout 2

    My solution was to use a sprite object instead of a layer, which fixed it, but the entire event still represents an issue where the status/values/whatever for layers are being saved from one layout to another, giving potential to various other problems in the future.

    As far as what I quoted, you said "try using the effect on layout instead of the layout. Layout, layout? Was that intended and I'm missing something? Entirely possible given my general lack of knowledge/experience, but it threw me off regardless.

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