How do I Fade one side of an object?

Get help using Construct 2

Post » Tue Apr 21, 2015 6:44 pm

Is there an effect that will cause an object to fade only on one side? When the player walks behind a pillar or something, I'd like it to go semitransparent. I could do this with a tween on opacity, but I think it would look better if the bottom of the pillar or tree or whatever stayed fully solid, while the top became translucent to show the player.

I'd want the Opacity at the sprite's y=0 to be 0, and the opacity at the sprite's Y= height to be 100.

If such a thing doesn't exist, could you point me toward documentation/tutorials on making effects?
B
14
S
5
G
1
Posts: 189
Reputation: 1,536

Post » Tue Apr 21, 2015 6:46 pm

You can't do anything like that.

You best bet is to split the object up into parts.
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925

Post » Tue Apr 21, 2015 7:17 pm

you could create two versions of the sprite.. one at full opacity and then another one partly opaque. load both jpgs into a sprite object, set the animation speed to 0.

start with frame 0, then when you need to go to the opaque one, set frame to 1.

pseudo code:
Code: Select all
Player Overlapping Pillar
Trigger Once While True
              Set Pillar frame 1

Player NOT Overlapping Pillar
Trigger Once While True
               Set Pillar frame 0


but to do it dynamically (i.e. a different part of the sprite depending on where the player is) is not possible in C2 as far as a I know.
Last edited by jobel on Tue Apr 21, 2015 7:19 pm, edited 1 time in total.
B
100
S
33
G
16
Posts: 1,204
Reputation: 16,865

Post » Tue Apr 21, 2015 7:18 pm

My workaround was going to be animations. Splitting into parts doesn't let me have a smooth opacity transition between the top and bottom. The problem with using animations is that it can't work with something that is already animated, like a swaying tree.

Are you sure this is completely impossible? We have stuff like this?

If the user's platform doesn't support webgl, I'll just deopacify the whole object.
B
14
S
5
G
1
Posts: 189
Reputation: 1,536

Post » Tue Apr 21, 2015 7:23 pm

bladedpenguin wrote: The problem with using animations is that it can't work with something that is already animated, like a swaying tree.


it could if you made two different animations.. one opaque and one not... I know it seems heavy handed, but depending on how many of these objects there are, it might not be too bad.

in order to only do part of the sprite, you'd have to somehow create a new image in memory anyhow.. I don't think you can manipulate part of the sprite in memory, unless someone made a plugin or something. I'm sure it's possible..
B
100
S
33
G
16
Posts: 1,204
Reputation: 16,865

Post » Tue Apr 21, 2015 7:30 pm

You can use a gradient sprite with Blend mode Destination-in.
www.blackhornettechnologies.com/Constru ... acity.capx
ImageImageImage
B
71
S
22
G
247
Posts: 3,756
Reputation: 137,558

Post » Tue Apr 21, 2015 7:40 pm

I read the original post a bit wrong, but like blackhornet's example you can do it with blend modes.

Here's another example to make only part of a sprite transparent:
https://dl.dropboxusercontent.com/u/542 ... blend.capx
B
94
S
33
G
113
Posts: 5,354
Reputation: 73,269

Post » Tue Apr 21, 2015 7:43 pm

might be able to request a shader from @Somebody
check out
nearly-daily-effects-by-somebody-neat-things-big-gifs_t123401?
B
100
S
33
G
16
Posts: 1,204
Reputation: 16,865

Post » Tue Apr 21, 2015 7:55 pm

I like @blackhornet 's solution.. just flip the gradient upside down and instead of toggling 'visible', add a quick Fade (behavior) in/out.. would look nice I think!
B
100
S
33
G
16
Posts: 1,204
Reputation: 16,865

Post » Tue Apr 21, 2015 8:07 pm

Won't the fade gradient touch everything else on that layer? I ask because sometimes the player walks in front of stuff, so i have the player on the same layer as the architecture. I guess I could put the architecture a layer above when I need to fade and on the same layer when I need the player in front.
B
14
S
5
G
1
Posts: 189
Reputation: 1,536

Next

Return to How do I....?

Who is online

Users browsing this forum: dop2000, wertt22 and 6 guests