Continuing the discussion from Aariv’s General Topic and announcements topic!:
I felt like this could use its own topic.
This is not the best way to code this, but it should work. If you do make this better, post about how you did it on this topic.
The first thing you’ll notice is that 217 shows up a lot. This is the B value in the RGB for the brightest part of the day. As you can see, if time is less than 217, it will increase time by one, redraw the background, wait a bit, then repeat until it is equal to 217. (Since it starts at 0. I explain more about the default values of variables here.)
Okay. This is the background ability. The check one of checks if time is greater than the G value of the brightest part of the day minus one. Since here it is 90, it checks if it’s greater than 89.
Why? Because the block inside is a draw a trail with a width of 3000. The color is an RGB block. R is set to zero, while G is 90-time. This means that thanks to the check if else, the lowest the g will get is 0. B is set to 217-time. Does that number seem familiar? Every other 217 in this project is based off of that specific one.
In the else area, I have the exact same code, but with one major difference: G is set to 0.
This is the delay ability. What it does is it waits the amount of blocks in the repeat times. For example, this ability takes as long as five flip blocks would take, but does absolutely nothing. This is useful, as we can prolong the day and night this way.
So that’s the code for 12:00 to 0:00. But what about from 0:00 to 12:00? That’s simple.
As you can see, in the else area of the very first check if else, we have almost identical code. There’s only one difference. Can you spot it?
We decrease time instead of increasing it.
And that’s it. Let me know if there’s anything you didn’t understand, and I’ll explain it.