Search Unity

How do i make the edge of the screen glow

Discussion in '2D' started by Urob_Oros, Jan 20, 2015.

  1. Urob_Oros

    Urob_Oros

    Joined:
    Oct 1, 2014
    Posts:
    14
    Hi, Im working on a 8-bit 2D platformer and i want to make a glowing line on the edge of the screen (left side and right side) when it requires touch input.

    I have the following code but i dont know if i should use a linerenderer, particle system, sprite animation, or if there are any other options.

    Code (CSharp):
    1. if(Input.mousePosition.x < Screen.width/2)
    2. {
    3. // Glow left edge of the screen.
    4. }
    5. else if(Input.mousePosition.x > Screen.width/2)
    6. {
    7. // Glow right side of the screen.
    8. }
    The attachment is the desired 8bit glow effect. the glow should be from top to bottom of the screen on each side, about a half inch in width. How should i go about doing this?

    Please help! thank you!
     

    Attached Files:

  2. TheZoran

    TheZoran

    Joined:
    Mar 6, 2012
    Posts:
    17
    Hello Urob_Oros,

    I don't understand how it should look like in the end. Could you give a little sketch or describe it more.
    Do you want the whole half to be glowed? or just the left/right borders?

    Greetz
    TheZoran
     
  3. Urob_Oros

    Urob_Oros

    Joined:
    Oct 1, 2014
    Posts:
    14
    Just the left/right borders.
    So using the attached image as an example:
    For the glow on the left side, it should have squares (pixels), left to right, colored dark green, green, light green, transparent.

    Thank you for your help!
     

    Attached Files:

  4. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    I'm sure there's a more efficient way to accomplish this in code, but if I was going to do it initially I would create one surface on the left edge and one on the right edge - textured as a glow effect and when the desired interaction is presented animate the alpha mask from transparent to opaque.
     
  5. Naphier

    Naphier

    Joined:
    Aug 4, 2014
    Posts:
    114
    I'd do the same. Put a sprite on each edge start with alpha 0 and increase the alpha on the appropriate glowing edge sprite depending on how far the mouse is away from the screen's edge. Maybe even start the increase in alpha before the mouse moves off screen.
     
  6. Urob_Oros

    Urob_Oros

    Joined:
    Oct 1, 2014
    Posts:
    14
    Thanks for the suggestions but i think im going to go the Particle way. This way i can make the glow dynamic and animate the glow and have little pixels emitting off the edge. i suck at art so making a sprite like that would be annoying..