Day and night cycle (SOLVED)

Started by Matti, Mon 04/02/2008 15:11:31

Previous topic - Next topic

Matti

Is there a possibility to make rooms be either shown in daylight or at night, without using two different rooms? The background animation doesn't help. Or is it possible to turn on/off the backgroundanimation (wherein is a darker room) and set the delay somehow to infinite?

If this was discussed earlier I'm sorry, but I found it nowhere..

Khris

There ought to be at least 5 threads about this. I think one pretty elaborate one was started by Da_Elf. Try searching the forums again.

Matti

Okay, thanks, this is the link:

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=28923.0

But I have to go through that some more times. Didn't understand yet how to avoid using several rooms for the day/night-effect.

Snake

Simplest way to do this:

Use a global int to tell when it is night or day and use the command SetBackgroundFrame();.

For example:

Say you have Global int 5 controlling day and night.
0=day
1=night
Background frame 0=day
Background frame 1=night

In the Repeatedly execute of any rooms containing day and night put this:
Code: ags

if (GetGlobalInt(5)==0) SetBackgroundFrame(0); //Day time has come

if (GetGlobalInt(5)==1) SetBackgroundFrame(1); //Night time has come


Hope this helps you,


--Snake
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"

Khris

#4
It's better practice to put this into before fadein.

Matti: doing it using one room is explained in depth starting about halfway down in the thread.

Matti

#5
Okay, thank you both, now I got it.

Khrismuc: You're right. I just ran over the page, so I shouldn't have written "I have to go through that some more times" but rather "I have to go through that in depth".

And special thanks to you for answering almost every question posted here..

VK Dan

Quote from: Snake on Mon 04/02/2008 16:16:23
Simplest way to do this:

Use a global int to tell when it is night or day and use the command SetBackgroundFrame();.

It would be better to create a global boolean instead. That would make the code a lot more readable.

Snake

QuoteIt's better practice to put this into before fadein.
Yes, you're absolutely right, that's what I would have done too after thinking about it.

QuoteIt would be better to create a global boolean instead. That would make the code a lot more readable.
Heh, I'm sure it would be. My scripting is always messy ;)


--Snake
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"

SMF spam blocked by CleanTalk