Fade out upper layer while moving down layers

Get help using Construct 2

Post » Wed Oct 09, 2013 4:04 am

MAIN CAPX: https://www.sugarsync.com/pf/D6025908_4317202_6930991

TEST CAPX: https://www.sugarsync.com/pf/D6025908_4317202_6933785

Alrighty! Next issue.
In the main capx, I adapted everything you helped set me up with. In your rendition, we have 3 layers to work with - 0 through 2. But in my main capx, I have a few other layers, namely the Effects layer, which is nestled between Ground and Floor2

So with that in mind, I created a new Function, "LayerNames" (see line 13 and line 12 for the Call action), to adapt the placement of the CharFinn object based on the value of CurrentLayer.

However, this isn't working, and I just don't understand why. I'm still struggling to grasp the parameters element of the functions, as well, which is probably ALSO why it's not working. (In another file, I tried swapping lines 9 and 11, thinking I had them in the wrong spots. Still no dice.)

I need a recap on the function parameters, too.
Here's the way I'm understanding them...

Let's say you're the "Ground" layer... 0.
So CharFinn collides with the StairsUp object...the Function kicks in:

Call ChangeLayer(min(NumberOfLayers-1, CurrentLayer+1))

Number of layers is 3 and the current layer is 0.

Call ChangeLayer(min(2,1))

So the minimum value is 1, and thus goes up to "Floor2" (per my additional Function).

Thanks again for your time.

(Alternatively, if you're busy, may I petition help from @squiddster, @ArcadEd, @Arima, @Blueblaze, or @TeamNotion? Heh, just someone who can spare a moment since @ramones has already given me much of his.)Rhindon2013-10-09 04:06:24
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
141
S
23
G
8
Posts: 790
Reputation: 15,017

Post » Wed Oct 09, 2013 9:05 pm

I hadn't considered layers between floors. Ok so new plan. I made an array called "FloorNames" that holds the names of the floor layers.

The function ChangeFloor(direction) is called with the parameter "up" or "down". It gets the index of the current floor in the array. If param(0) = "up" and you're not on the top floor then it calls the function ChangeLayer("layerName") with the name of the next floor in the array.
If param(0) = "down" and you're not on the bottom floor then it calls ChangeLayer("layerName") with the name of the previous floor in the array.

The ChangeLayer("layername") function moves the player to the layer given and activates the fade group.

And then the FadeTopFloors group loops through the array and fades the layers that come after the current layer.

I don't know if this is easier or harder to understand.

OpPASS%20v1-1-7_edit.capx

B
55
S
29
G
19
Posts: 1,520
Reputation: 25,650

Post » Thu Oct 10, 2013 4:37 am

@ramones - Well, your explanation made sense. I'll try to follow along in the capx, itself. Thank you once again, sir! (I think I'm gonna have to give you SEVERAL slots-worth in the post-game credits. LOL)
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
141
S
23
G
8
Posts: 790
Reputation: 15,017

Post » Thu Oct 10, 2013 5:10 am

Looks good! Except now the layers, themselves don't scale...just the CharFinn object. I'll look over it, but maybe you can see what happened?
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
141
S
23
G
8
Posts: 790
Reputation: 15,017

Post » Thu Oct 10, 2013 2:21 pm

Ahh change CurrentLayerScaleValue to LayerScale(CharFinn.LayerName) in event 17.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,650

Post » Fri Oct 11, 2013 3:18 am

@ramones - Dude, I can't wait to have insight like you do. I'm slowly getting the hang of reading C2 like it's nothing, but THINKING in C2, that's still another story. Thank you again!
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
141
S
23
G
8
Posts: 790
Reputation: 15,017

Previous

Return to How do I....?

Who is online

Users browsing this forum: beohs, Blendi1223, Elliott, MadSpy and 11 guests