Day Night Cycle issue

Hey again everyone.

I have been working on Day and Night Cycles in my game ( @jamie_c I used one of your tutorials so maybe you could shed some light) http://www.jamie-cross.net/?portfolio=gamesalad-full-screen-effects-tutorialdemo-blood-edge-daynight-cycle-night-vision-broken-glass-and-spotlight#.V2DB1lfYdEw

My game is based on Day and Night Cycles. The goal is for the hero to spend more time in the day than the night ( things happen at night that slows down the hero mission)

My day cycle is about 5 min, but the hero can add time to this by picking up items. But sooner or later the timer will hit 0 and nighttime comes.

So right now I have a progress bar/timer. Once it hits 0, the night fades in, and will not get light again until certain Items are picked up.

This works great on the current scene......but when I leave the scene and go to the next scene, the night time fades in again. I don't want it to fade in once it has already entered the night cycle. I only what it to fade in or out when I go from Day to Night or Night to Day and not fading when switching scene during the night cycle.... Make sense?

game.nighttime is triggered when the progress bar hits O, game.daytime is triggered when the Progress bar is 1 or more

Here are my rules

Rule 1 ( Start Night)
if game.nighttime is true
Interpolate
Self.Color.Red to 0.2 ( Duration 5) Function Linear
Interpolate
Self.Color.Green to 0.2 ( Duration 5) Function Linear
Interpolate
Self.Color.Blue to 0.2 ( Duration 5) Function Linear
Otherwise
game.day to true.

Rule 2 ( Start Day)
if game.daytime is true
Interpolate
Self.Color.Red to 1 ( Duration 5) Function Linear
Interpolate
Self.Color.Green to 1 ( Duration 5) Function Linear
Interpolate
Self.Color.Blue to 1 ( Duration 5) Function Linear
Otherwise
game.night time to true.

I am sure this is a simple fix, but I have not been able to figure out the logic to make it happen.

Thanks

Comments

  • IceboxIcebox Member Posts: 1,485
    edited June 2016

    This works great on the current scene......but when I leave the scene and go to the next scene, the night time fades in again. I don't want it to fade in once it has already entered the night cycle. I only what it to fade in or out when I go from Day to Night or Night to Day and not fading when switching scene during the night cycle.

    Try this .. im not sure it will work

    if game.night is true
    inside this rule add another rule
    If self.time is less than 1

    Change attribute
    Self.Color.Red to 0.2
    Change attribute
    Self.Color.Green to 0.2
    Change attribute
    Self.Color.Blue to 0.2
    Otherwise
    Interpolate
    Self.Color.Red to 0.2 ( Duration 5) Function Linear
    Interpolate
    Self.Color.Green to 0.2 ( Duration 5) Function Linear
    Interpolate
    Self.Color.Blue to 0.2 ( Duration 5) Function Linear

    So if your starting a new scene and night is true and the time is less than 1 , it will change the color instantly , but if the time is greater than one , your in the middle of the scene and night is triggered it will fade to night time. I hope this made sense

    EDIT: I just noticed you have two boleans for day and night , i think you can do this with only one attribute instead , if night is true then fade to night , if its false then fade to day light.

  • quinn221quinn221 Member Posts: 280

    @Icebox it works, you are awesome! I never thought about using a self timer!

  • SocksSocks London, UK.Member Posts: 12,822
    edited June 2016

    //

  • quinn221quinn221 Member Posts: 280

    EDIT: I just noticed you have two boleans for day and night , i think you can do this with only one attribute instead , if night is true then fade to night , if its false then fade to day light.

    Right Again...thanks

  • IceboxIcebox Member Posts: 1,485

    @quinn221 You welcome :) wish you the best

Sign In or Register to comment.