Day & Night Cycle?

0 favourites
  • 4 posts
From the Asset Store
Action packed 2 track pack for use in your projects
  • I just found out about construct 2 and started scraping some kind of mini survival game from scratch with little to no tutorials.

    So far I've made a good progress but got stuck on day&night cycle for a long time, because I use a black layer on top of everything as pure night and an black object with destination out blend mode as a sun in order to get a player light range around my character sprite at night , so a fade behaviour was not a way to go and while loops kept crashing my stuff even with stop loop action and changing booleans , so this is my outcome which actually works as intended and even tells me when it's actually full night (night = 1 , not counting day -> night transition) in order to spawn enemies and stuff at night. Any ideas how else could this been done or improwed?

    also: the opacity goes from 100 to 10 that's why its +9 and -9 repeating 10 times instead of +&-10

  • Had some fun coming up with this one because there's a lot of ways to do this.

    This is what I came up with it is very simple and versatile and can be changed on the fly, it uses a simple timer and then sets the Opacity every tick with a simple ratio.

    Timer.CurrentTime / Timer.Duration * desired opacity[/code:v7jov4dx] 
    Then at the end of the timer it sets a global variable to night. 
    Then for transitioning to day we do is this
    [code:v7jov4dx]desired opacity -Timer.CurrentTime / Timer.Duration * desired opacity[/code:v7jov4dx] 
    This is what it looks like in the editor [img=""]
    Anyways here's the example if you have any other questions just ask, and if you have any future problems feel free to contact me. 
    Good luck on your project <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">
    [url=] ... .capx?dl=0[/url]
    How timers work [url][/url]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I PMed you a bit ago so here's an example cooked up for you: ... ystem.capx

  • Thanks for your variations guys

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