# Some math problems

0 favourites
• 6 posts
From the Asset Store
Aliens are invading our planet! Solve the math question, and attack the alien with your laser. Covers addition, subtract
• 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:[attachment=0:20zzzuq5][/attachment:20zzzuq5]

• ## Try Construct 3

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

Construct 3 users don't see these ads
• 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.

• I don't see a "value" property where I can change the formula...Any chance you could provide me with an example?

• Here is the ugliest explanation sheet you can ever see:

Hope that helps.

• Hye,is there value only parameter?I have never used sine in C2(I used it once in CC).Thanks for the info.

• 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!

• 6 posts