# Some math problems

Get help using Construct 2

### » Fri Feb 28, 2014 3:51 pm

Hello, I hope you guys can give me some insight into how I can make this work...

I'm trying to make a day/night cycle by moving gradients up and down, depending on the time of day (which, in turn, is determined by the rotation of the sun and moon). So, for example, at 7 o'clock, the sun sprite is at105 degrees, the sun is coming up, and red gradient moves up to indicate dawn.

I figured, since red comes up twice (at dusk and dawn), it has to move according to a function. I plotted red's Y value against time of day, and got a function out of it from a graphing calculator. I rounded the values a bit and tested this graph, and it was close enough.

So in the event sheet I used
Every tick - Sprite2 - Set position to ((744.3*(sin(0.5*TimeOfDay+1)))+1271.1)

And yet it does not move at all...I used the layout debug build and saw that it does, in fact, move, but very small amounts. Any clues as to why that might be happening?

EDIT: Here's the capx:
DayNight.capx
You do not have the required permissions to view the files attached to this post.
B
5
G
1
Posts: 22
Reputation: 467

### » Fri Feb 28, 2014 4:38 pm

I think you can use sine behaviour here, for both the color of the sun and positioning of it. Check out sine behaviours parameters on the left side, there is a "value" property there.
B
18
S
4
G
1
Posts: 332
Reputation: 3,149

### » Fri Feb 28, 2014 10:49 pm

I don't see a "value" property where I can change the formula...Any chance you could provide me with an example?
B
5
G
1
Posts: 22
Reputation: 467

### » Sat Mar 01, 2014 10:13 am

Here is the ugliest explanation sheet you can ever see:

Hope that helps.
B
18
S
4
G
1
Posts: 332
Reputation: 3,149

### » Sat Mar 01, 2014 11:56 am

Hye,is there value only parameter?I have never used sine in C2(I used it once in CC).Thanks for the info.
I will not let you reach the sisters
Nature Forums
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

### » Mon Mar 03, 2014 11:40 pm

Thanks for the help, Windwalker, but I'm still not sure how to change it in a useful way for my project. Gonna try a few other ways of getting the effect I wanted, thanks again!
B
5
G
1
Posts: 22
Reputation: 467