How do I add a Terraria-like lighting effect?

0 favourites
  • 5 posts
From the Asset Store
Customize the animation of character when item changed
  • So I'm making a pseudo-horror game and I'm struggling to get light sources to work properly. I'm using radial gradient sprites for light sources because I can adjust their size and transparency, and using layer blend modes I've figured out how to make it so that objects appear black when not lit, but I've started running into issues. As I have it now, the background can be seen through the other objects, and it gets less visible closer to light sources, while the other objects become more visible closer to light sources (as they should). When I change the layer blend modes, the only way to make this not happen apparently involves making the background black along with the objects.

    For some context, the game begins on a spaceship orbiting a planet, which can be seen in the background. I want the ship to have a couple light sources, but outside of those light sources, the ship should be completely dark (the player themselves will be a light source themselves to fix this). However, the background should still be visible.

    Ultimately I am trying to achieve the following things:

    - Light sources (white gradients) illuminate surroundings rather than just turning them white

    - Objects are black when not in the presence of a light source

    - The background is always visible regardless of nearby light sources

    Here is the drive link for the .c3p file. drive.google.com/file/d/1M3_mDKXR16xAhkP_9FOu-N3lOHY2eAby/view

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • impossible to open (chat gpt plugin is needed)

  • Ah shoot, uhh...

    drive.google.com/file/d/17q59CDVQOL-LE06Ja5ELG5UajcJF7TWX/view

    Think this one should open.

  • Bump.

    Let me know if bumping is not allowed; I just know it's common practice in many forums.

  • Here's one possible solution. Can't make an example with the free version.

    + layer 1: force own texture
    |-+ light: force own texture, effect darken, transparent no, color black, 
    |-------- light gradients with destination-out blend
    |-+ level: level stuff
    + layer 0: background

    Basically you'd have a light layer that's black with the light gradients with the destination-out or additive blend. The layer has force own texture so we can apply it to another layer.

    Below that you have a normal layer with all of your layer.

    To show a normal background layer under all that you'd place the light and level layers as sub-layers to a new layer with force own texture. Finally add a bottom layer with the background.

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