How do I make my character darker when stepping in shadows?

Get help using Construct 2

Post » Tue Feb 24, 2015 11:14 am

I have a basic level set up and some areas are darker. These areas are on a layer called "shadows" on top of my main background layer where all shadow sprites are placed. On top of that are objects, player, etc. I wan't my character to get darker as well when stepping on those shadow sprites or shaded areas.

What would be the best way to go about doing that?

Using collisions or have this layer act as some kind of mask?

Preferably a mask would be better to have the character gradually change color, based on the grayscale images in the shadow layer. Since the shadows can have have different intensity. Completely black or anywhere in between.

I guess WebGL effects are the way to go, but i havn't figured out how i would go about doing the effect I'm after.
Follow my progress on Twitter
or in this thread Archer Devlog
B
42
S
18
G
19
Posts: 1,058
Reputation: 14,050

Post » Tue Feb 24, 2015 11:32 am

@tunepunk
you can use webgl effects, or you can create a black square sprite, and change the blend mode to additive, and toggle the opacity on off when the actor is out of the shadow area or inside it. set the position on everytick yourhero.x yourhero.y kinda that's it. if doesn't try webgl effects with color correction, but not sure will work with it. let me test it first. also you could drop the shadow part and just add a light bulb object to cast the light, and a shadow behavior on the main actor. and will automatically do it for u . its more simple then what u have.


here is a capx example for the shadow light effect http://www.girlshare.ro/34489956.6
B
78
S
23
G
69
Posts: 1,354
Reputation: 44,027

Post » Tue Feb 24, 2015 2:43 pm

Would it be possible to get the Hex code from a certain pixel on a certain layer?

Let's say I place a white to black gradient on a one layer. When the character moves across this gradient from white to black he would gradually get darker.

So when he is stepping on white, i want to catch 255,255,255, or FFFFFF or something like that, and on black, 0,0,0, or 000000, then by these numbers control the intensity of a certain layer effect?

Kind of like controlling the tint of the character based on what color he is standing on.
Follow my progress on Twitter
or in this thread Archer Devlog
B
42
S
18
G
19
Posts: 1,058
Reputation: 14,050

Post » Tue Feb 24, 2015 3:36 pm

tunepunk wrote:Would it be possible to get the Hex code from a certain pixel on a certain layer?

Let's say I place a white to black gradient on a one layer. When the character moves across this gradient from white to black he would gradually get darker.

So when he is stepping on white, i want to catch 255,255,255, or FFFFFF or something like that, and on black, 0,0,0, or 000000, then by these numbers control the intensity of a certain layer effect?

Kind of like controlling the tint of the character based on what color he is standing on.



yes exactly like that but that u can do it with from effects, and color control, but i think it will change ur character color as hole, but i know there is a tint effect also... let me check
B
78
S
23
G
69
Posts: 1,354
Reputation: 44,027

Post » Tue Feb 24, 2015 3:58 pm

The problem is picking the color. Seems the only way to get a color at a certain position is to use the Canvas Plugin, and use expression. rgbAt(x,y) or is there any other way to get the color of a certain point?
Follow my progress on Twitter
or in this thread Archer Devlog
B
42
S
18
G
19
Posts: 1,058
Reputation: 14,050


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests