How To Make Light Follow User?

Discussion in 'How Can I...?' started by steveg, Aug 15, 2018.

  1. steveg

    steveg Boxer

    Joined:
    Aug 10, 2018
    Messages:
    3
    Likes Received:
    1
    Hi, I've been all through this forum, google, etc, and I cannot figure out how to do this.
    I have built a side scroller from one of the templates. I just want to add a light source that stays at the top left of the screen. I guess kinda follow the character. Instead, when I add a light source, it just scrolls to the left with the platform. I want it to stay with the player, not the platform.
    Any help would be appreciated, because I can't figure it out.
    Thanks
    Steve
     
    volcank likes this.
  2. volcank

    volcank Serious Boxer

    Joined:
    Oct 8, 2015
    Messages:
    794
    Likes Received:
    391
    I was gonna say like link the light to the player or copy and paste it inside the game character sprite settings but still the light object will jump when the player jumps.

    What you can do is you can create that object as a png image inside Photoshop or similar graphics sofware. Just create a soft edged sphere then import it as foreground so it always stays at top and set its speed to 0. Never tried btw only that is what comes to my mind at the moment. You can also try to find other png light sources at google. Search for lens flares png etc. at google search. Only make sure it is soft edged and transparent. This way only the light won't cast shadow but you will have a nice light object always at top left corner of the game.
     
    steveg likes this.
  3. steveg

    steveg Boxer

    Joined:
    Aug 10, 2018
    Messages:
    3
    Likes Received:
    1
    Thanks volcank, ok, that makes sense, but what I actually meant was a light source. I want to keep a light source in the top left and casting a shadow on my character. I can't find any way to make the light source stay there.
     
  4. Phill Mason

    Phill Mason Serious Boxer

    Joined:
    Sep 25, 2015
    Messages:
    880
    Likes Received:
    721
    Hi @steveg, welcome to the forum. An alternative way to get an image to remain static throughout your game, is to add it to your UI. If you have only one UI, drop in your light source into the Ui in the position you want. This way, everything in your game will move as expected, but your light source with remain still, just like a score label in your UI. If you're using multiple UI's, you will need to add it to each one. As far as casting shadows, I'm pretty sure it won't work using this setup. As @volcank also mentioned, you could attach it to your character, but it will of course move with your character. I just checked in BB2 and you cannot copy 'n' paste scene objects (light sources) in a UI, so it would need to be an image to get a similar effect. Good luck.
     
    Last edited: Aug 16, 2018
    steveg and volcank like this.
  5. steveg

    steveg Boxer

    Joined:
    Aug 10, 2018
    Messages:
    3
    Likes Received:
    1
    Thanks @phill-mason and @volcank, i appreciate both of your help. You've given me a good start. Thanks. I'll have a play.
     

Share This Page