First of all. Thank you very much for providing a platform where people such as myself can come and learn from others. I have learned a lot already and am sure will use this forum for many more things.
Anyway, on to the problem. I am working on a visual novel where time will have to be displayed. It's at very early stages and just working on the layout, interface, etc. before continueing. I have managed to get a simple clock showing and am able to alter the time.
This will be initialized at the start:
Code: Select all
$ minutes = 420
$ clock_hours = minutes / 60
$ clock_minutes = minutes - (clock_hours * 60)
$ day = 1
Code: Select all
$ minutes += 15
if (minutes >= 1440):
$ day += 1
$ minutes = 420
$ clock_hours = minutes / 60
$ clock_minutes = minutes - (clock_hours * 60)
"The time has jumped 15 minutes."
$ minutes += 1005
if (minutes >= 1440):
$ day += 1
$ minutes = 420
$ clock_hours = minutes / 60
$ clock_minutes = minutes - (clock_hours * 60)
"It is now the next day."
From a few other programming languages (I have a tiny bit of experience here and there, but lacking in many, for example Python), I know there are 'methods' that can be defined in certain languages, which can be 'run' everytime they're 'called'.
I was hoping that, instead of having to add the extra lines in the second piece of code, I could just add a single line (the method), which would recalculate the time every time it's changed or so that it runs every time a mouseClick is performed or maybe even continuously? Maybe a label that can be jumped to, run and then 'jumped' back to where we left off? If that's even possible.
I am sure there is a pretty easy and 'tidy' solution for this, but I am stumped as the few things I have tried did not seem to work.
Thanks in advance for your time!