Problem with day night cycle?

0 favourites
  • 4 posts
From the Asset Store
Action packed 2 track pack for use in your projects
  • So I have my clock in game working perfectly and when I get to 5pm I want it to start getting darker. This is what I have but for some reason none of these events will run(even tho the initial "evening" event triggers when 5pm hits. I have gotten the ability to set layer opacity working when the hour changes but i want a smoother transition throughout the hour (each hour is 1 minute in game). Any ideas on getting this to work?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sorry, nevermind..

  • kryptopixel i figured out a way to accomplish it in a different way using my hour variable and another variable together! Thanks for the suggestion anyway!

  • Glad that you found a way, let me share a way that could help.

    First, how long it takes to go from sunny to fully dark? In my example, lets say 2 hours.

    So, at 5pm it will start to go darker till 7pm when it is fully dark. (From 0 to 100% opacity).

    I would do something like this:

    On 5pm set stage to -> sunset

    Is stage = sunset and sprite opacity is not equal to 100%:

    Every 1 second set sprite opacity to self.opacity + 0.83 (0.83 because we have 2 hours in 120 seconds, so 100/120).

    What will happen is: at 5pm it will start to change the opacity 0.83% every second till reach 100%. You can also do the same for sunrise, inverting the opacity. If you want less time or more time on the process, just calc 100/seconds you want.

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