Blending alpha for black rectangle (fade to dark)? [SOLVED]

Discussion in 'Programming' started by OblivionSkull21, Jul 24, 2019.

  1. OblivionSkull21

    OblivionSkull21 Member

    Joined:
    Sep 26, 2017
    Posts:
    306
    I'm incorporating a day/night cycle in my game. The way I have it set up is that, when it's sunset, a black rectangle at .75 opacity starts to move across the screen from the left until it covers the entire room, like how sunlight would work in an actual sunset. Think of it like a wall of darkness closing in.

    This is cool and all, but in order for it to be more realistic, the rectangle shouldn't all be one shade. The closer to the light it is, the lighter the shadow, right?

    So, what I'm wanting is to have the rectangle blend from an opacity of 0 right where the light touches to an opacity of .75 deep inside the shadow. Is this possible? I am using draw_set_alpha.

    EDIT: The rectangle is being drawn. It is not an object.
     
  2. Annoyed Grunt

    Annoyed Grunt Member

    Joined:
    Jun 20, 2016
    Posts:
    136
    OblivionSkull21 likes this.
  3. OblivionSkull21

    OblivionSkull21 Member

    Joined:
    Sep 26, 2017
    Posts:
    306
    Perfect! Thanks.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice