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

0 favourites
  • 5 posts
From the Asset Store
2d warrior machrom platformer game character assets
  • 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.

  • 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

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

  • 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?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)