Layer Opacity Won't Reset

Get help using Construct 2

Post » Tue May 13, 2014 11:44 pm

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.
B
19
S
10
Posts: 51
Reputation: 1,675

Post » Wed May 14, 2014 12:40 am

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 https://www.scirra.com/tutorials/384/scene-transition-with-shaders

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

Hope this helps
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,273

Post » Wed May 14, 2014 3:57 am

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

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.
B
19
S
10
Posts: 51
Reputation: 1,675

Post » Wed May 14, 2014 1:22 pm

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.
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,273

Post » Thu May 15, 2014 4:21 pm

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.
B
19
S
10
Posts: 51
Reputation: 1,675


Return to How do I....?

Who is online

Users browsing this forum: David181 and 16 guests