[Solved] How do I fix this Fade problem?

Get help using Construct 2

Post » Tue Aug 09, 2016 8:30 am

I have an object with 2 different Fades - Fade only has Fade In, Fade2 only has Fade out. Neither have destroy on Fade out.

The object is already created and visible on the layout, but there are doors that cover it so the user can not actually see it. On Start of layout the Fade2 runs (Fade Out).

The doors open and the Fade runs (Fade In). After some user input the doors start to close and the Fade2 runs again (Fade Out).

So far, so good.

The object moves to a different X/Y position. The doors open. The Fade 'should' run again here, but it doesn't. The object won't fade in again. I have ran the debug mode and i can tell the object is in the new position, but it's getting hung up on the Fade in.

In Debug Mode
On Start of Layout on the Fade2 (Fade Out) it says "Stage" - Fade Out > Done.

The doors open and the Fade (Fade In) says "Stage - Fade In > fade out. I don't know why it wouldn't go to done after fade in.

User input and the doors close. Fade2 runs, "Stage" says fade-out > done.

Doors open a second time and the object is in the new position, "Stage" hangs on fade in


I have looked over my code and everything seems fine. If i disable the Fade2 the second time it runs, of course because the object doesn't fade out, the object moves and stays visible. But the debug mode still says Fade Out in the "Stage" box.

This is boggling my mind. I've tried reversing the fades - switching the fade in/out on both fades and in the code. I've tried giving them different triggers. The outcome is still the same.


Any help with this problem is greatly appreciated.
Last edited by jeffige on Tue Aug 09, 2016 5:22 pm, edited 1 time in total.
B
38
S
18
G
19
Posts: 664
Reputation: 14,112

Post » Tue Aug 09, 2016 9:04 am

As you mentioned, it seems like the Sprite is still set to 'fade out' instead of 'done' when you have a fade out of 0, I assume that's what you set for the Sprite that 'doesn't have a fade out'. Even with very simple keyboard presses it wasn't working correctly for me when I took the fade out away from the object. The fact that it's still waiting for the fade out might be a C2 problem I'm not sure...I guess the behaviour always waits for the fade out even if it is set to 0 for 'skip', there could be some kind of work around I'll keep looking...

@ashley if fade out is skipped, set to 0, should the 'stage' of the behaviour in debug be set to 'done' rather than stuck in 'fade out' ?
B
47
S
18
G
84
Posts: 2,271
Reputation: 49,796

Post » Tue Aug 09, 2016 4:33 pm

Yes, it seems like C2 waits for the 'Fade Out' to run even if the Wait and Fade Out timer's are set to 0. I would think if it's set to 0 that says "hey, don't do this" cause there is nothing here, reset instead, just do that and reset. But i guess there is no trigger to reset the behavior.

It seems weird that on a second Fade Behavior with 'fade in' and 'wait' set to 0, the 'fade out' would do the same thing - wait for the 'fade in' part to run and finish before continuing on to execute the 'fade out' part.
B
38
S
18
G
19
Posts: 664
Reputation: 14,112

Post » Tue Aug 09, 2016 4:56 pm

I just tested different scenarios and got it to run. These are the sprite behaviors:

FADE
Active at start - No
Fade in time - 1
Wait time - 0
Fade out time - 0
Destroy on Fade out - No

Fade2
Active at start - No
Fade in time - 0
Wait time - 0
Fade out time - 1
Destroy on Fade out - No


And these are the actions:

Sprite 1 - Fade2 > Start Fade

System - Wait > 2 seconds

Sprite 1 - Fade > Start Fade

System - Wait > 2 seconds

Sprite 1 - Fade2 > Start Fade

Sprite 1 > On Fade2 finished > Set Position - X > 640, Y 250

System - Wait > 2 seconds

Sprite 1 - Fade > Start Fade

After the 1st Fade triggers - the Fade would not execute a second time - a Restart Fade must trigger to reset the Fade behavior. Which again, i think is weird since the Fade2 behavior does not need a restart, even if the fade in has 0 and therefore has not executed.

So, these are the NEW Actions:

Sprite 1 - Fade2 > Start Fade

System - Wait > 2 seconds

Sprite 1 - Fade > Start Fade

System - Wait > 2 seconds

Sprite 1 - Fade2 > Start Fade

Sprite 1 > On Fade2 finished > Set Position - X > 640, Y 250

System - Wait > 2 seconds

Sprite 1 - Fade > Restart fade.


This works without any problems.
B
38
S
18
G
19
Posts: 664
Reputation: 14,112

Post » Tue Aug 09, 2016 5:48 pm

Yeah was taking a look into restart but I didn't suggest it because it didn't seem to work for Fade2 because you can't restart the fade out, it still gets stuck. Might be good enough for what you've made though if it ends with that Sprite 1 Fade.
B
47
S
18
G
84
Posts: 2,271
Reputation: 49,796


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 29 guests