How do I control the Day to Night mini-Cycle?

0 favourites
  • 8 posts
From the Asset Store
Perfect for your zombie game! Animated from motion capture data Left, Right, Top Down!
  • I've been trying to apply the method Rory gave on this threat 2 Years ago based on the day to night cycle. But applying such a cycle can be a bit devastating. You see, I want the Day to Night cycle of the sun and Moon orbit around the mini map that I've assigned. But Unfortunately, it requires a lot of mathematical approach towards problem solving this issue that I'm currently having. Here is the event that I've assigned on my mini map cycle (it is originally done by Rory. But I've changed the values): -

    the mini map's size is at around: 245.603, 183.059, and it lies on the top left side of the screen.

    Global Value: Name: Period, Type: Numeric and the rest are default

    Event > System: Every tick: Set Period to time*20 (for testing procedures, I need to assign the time 20 times faster than its original real time).

    : Sun: Set position to (1037 -sin(Period)*150 ,172-sin(Period)*-10 )

    At first, I'm testing whether the Sun is able to orbit around the mini map from Dawn to Dusk. But I can't get the value right. Is there an another approach towards this? Or Do I need to explain even further in details just for the problem that I'm currently facing to be quite clear?

    Cheers,

    Abdul

  • Maybe I don't understand the problem, but why are you doing it the hard way?

    I'd just create a sun sprite and set the origin wherever you need it (For example at the horizon when the sun is rising). Then give the sun the rotate behavior.

    To check whether it's night or day just ask if sun is on screen

  • Good point. I think I'll try what You've suggested. I'll let You know if Your method works :}.

  • It worked! Thanks for that Raben. I have one more question however. Is there a way to apply the sun's rotation based on the In-Game time standards? such as each In-game Hour is equivilant to 1-2 Minutes

  • Sure, you can change the rotate speed. It tells you how many degrees the sun will rotate in one second. Since a circle has 360 degrees you could just divide them by the seconds the sun should take to do one rotation.

    Examples:

    One minute: 360° / 60 seconds = 6 rotationspeed

    Two minutes: 360° / 120 seconds = 3 rotationspeed

    and so on.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It worked out well than anticipated. Thanks for that Raben. But there is one more thing that still bothers me. How am I able to control both the Sun and Moon cycle on different in-game time period (e.g. the Sun operates from Dawn to Dusk, while the Moon operates from the position where Dawn usually goes and falls down to the position where Dusk usually lies)?

  • I'm not sure if I understood what you mean (Sorry I'm not a native speaker). But when you want the moon do rotate anti clockwise just set the rotation speed to minus.

  • I'll give it a shot. Thanks for the info man.

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