In a scene on my game, I wanted an image to change according to the real time the person is playing.
If it's something between like 6pm till 7pm I wanted "windowsun.png" to show up and if it's from 8pm till 5am I wanted "windowmoon.png" to show up.
It's a scene in the living room. And according to the real time, I wanted it to show the window with the sun outside or with the moon.
How can I do it? Is it using the "If" statements?
I still get confused about it.
Thanks.
How do I change an image according to real time?
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
- Per K Grok
- Miko-Class Veteran
- Posts: 882
- Joined: Fri May 18, 2018 1:02 am
- Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
- itch: per-k-grok
- Location: Sverige
- Contact:
Re: How do I change an image according to real time?
Yes, you can use an if statement.Nanahs wrote: ↑Mon Dec 10, 2018 8:47 pm In a scene on my game, I wanted an image to change according to the real time the person is playing.
If it's something between like 6pm till 7pm I wanted "windowsun.png" to show up and if it's from 8pm till 5am I wanted "windowmoon.png" to show up.
It's a scene in the living room. And according to the real time, I wanted it to show the window with the sun outside or with the moon.
How can I do it? Is it using the "If" statements?
I still get confused about it.
Thanks.
You use a variable (you could name it 'vHour') to hold the hour information from the time module. I am assuming you know how to do that. Is that correct?
You can then decide which image to show like this.
Code: Select all
if vHour==18 or vHour==19:
show windowsun
elif vHour>19 or vHour<6:
show windowmoon
Re: How do I change an image according to real time?
Thank you!Per K Grok wrote: ↑Tue Dec 11, 2018 2:18 amYes, you can use an if statement.Nanahs wrote: ↑Mon Dec 10, 2018 8:47 pm In a scene on my game, I wanted an image to change according to the real time the person is playing.
If it's something between like 6pm till 7pm I wanted "windowsun.png" to show up and if it's from 8pm till 5am I wanted "windowmoon.png" to show up.
It's a scene in the living room. And according to the real time, I wanted it to show the window with the sun outside or with the moon.
How can I do it? Is it using the "If" statements?
I still get confused about it.
Thanks.
You use a variable (you could name it 'vHour') to hold the hour information from the time module. I am assuming you know how to do that. Is that correct?
You can then decide which image to show like this.
Code: Select all
if vHour==18 or vHour==19: show windowsun elif vHour>19 or vHour<6: show windowmoon
About time, I only know how to show the current hour, and day/month/year. My knowledge stops right there I guess hah
Who is online
Users browsing this forum: Majestic-12 [Bot]