2D Top Down Day/Night Cycle
This is one of the biggest questions about making games for me. How to make a day-night cycle in a 2D Top-Down shooter? I've been searching for a long time, but i found nothing about a top down shooter day-night cycle.
Can anyone help me?
you mean just to change the intensity of the light? Or some more indepth night vs day functionality?
@Scribe I have no light in my game(2D), i want some more indepth night/day functionality. Also the game is a top down shooter. I just want when it's day objects to be lu$$anonymous$$ous, and when it's night to be very dark.
you are using unlit shaders then I assume? You could add some global shader properties, like 'lightness' which you adjust from code to alter the brightness of your tiles. If the shadows of the game are painted directly into the tiles, you may find it difficult to mess with them, if they are separate sprites, you could try scaling them either through shaders or transforms, and changing their positions, based on where someone would expect the 'sun' to be.
It is quite easy to set up a timer, to keep track of the time of day/night and dates/time of year etc, all of which is not explicit to a 2D game, so for the indepth functionality, you can just look for general day-night handling and ti$$anonymous$$g.
Answer by Winterblood · Apr 29, 2016 at 12:45 PM
Same as any other game, except that since you can't see the sky itself, you'll have to convey the time of day by the angle and colour of the light cast on the scene - orange/yellow with long shadows at dawn, white with short shadows at noon, orange/pink with long shadows in the opposite direction at sunset, blue at night with faint moonshadows.
Set up a directional light and play around with controlling it's direction, colour and brightness from code.
[EDIT: Sorry, missed the "2D". In that case you'll have to just tint your sprites - although there are some 2D shadow-approximating plugins you could try.]
Your answer
Follow this Question
Related Questions
UnityEngine.Invoke() Doesn't work properly with values under 1? 0 Answers
Day/Night cycle turns black at night and how to Serialize it rightly? 0 Answers
Sun Variable Rotation 1 Answer
change one object into another, and then back again 1 Answer
Why does my Color.Lerp switch the colors on every other cycle? 0 Answers