Day & Night Cycle?

Get help using Construct 2

Post » Mon Oct 03, 2016 6:22 pm

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

Posts: 2
Reputation: 177

Post » Mon Oct 03, 2016 7:33 pm

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.
Code: Select all
Timer.CurrentTime / Timer.Duration * desired opacity

Then at the end of the timer it sets a global variable to night.

Then for transitioning to day we do is this
Code: Select all
desired opacity -Timer.CurrentTime / Timer.Duration * desired opacity

This is what it looks like in the editor Image

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 :D ... .capx?dl=0

How timers work
Posts: 33
Reputation: 3,483

Post » Tue Oct 04, 2016 2:49 am

I PMed you a bit ago so here's an example cooked up for you: ... ystem.capx
Zelda Gamekit (my project)

Example capxs:

Zelda-Style Inventory

Zelda Health

3-saveslot system

[url=]Zelda-like Dialogue[
Posts: 556
Reputation: 19,867

Post » Tue Oct 04, 2016 10:48 am

Thanks for your variations guys :) it's always really nice to see the same logic from other peoples perspective, I really like brandons alternative, will be toying with and redoing stuff a lot anyway , I love the possibilities of construct and organization of stuff , there's a lot to learn :)
Posts: 2
Reputation: 177

Return to How do I....?

Who is online

Users browsing this forum: totoe and 5 guests