In certain sections of my game I’ve got a countdown going and want to display text when that countdown reaches certain numbers. I’m hoping to future proof this a little by setting up those moments to fire at whole number percentages of the original starting number, so that later I can adjust the original starting number in response to tester feedback without having to edit the math of whole thing.
I’ve read through Chapter 15 and unfortunately it doesn’t offer enough practical usage for the likes of me.
Below is some fake code to give a sense of what I’m hoping to do. Obviously, this is not correct.
Kitchen is a room.
The Microwave is scenery in Kitchen. The description of Kitchen is "You just popped your frozen dinner into the microwave and now wait for it to finish."
StartingTime is a number. StartingTime is 12.
MicrowaveCountdown is a number that varies. MicrowaveCountdown is initially 12.
Every turn when the player is in Kitchen:
if MicrowaveCountdown is not 0:
decrease MicrowaveCountdown by 1;
if MicrowaveCountdown is ((StartingTime)-(StartingTime multiplied by .75 rounded to the nearest whole number))":
say "'This is taking forever.'";
if MicrowaveCountdown is ((StartingTime)-(StartingTime multiplied by .5 rounded to the nearest whole number)):
say "Your stomach rumbles.";
if MicrowaveCountdown is ((StartingTime)-(StartingTime multiplied by .25 rounded to the nearest whole number)):
say "'So close and yet so far.'";
otherwise if MicrowaveCount is 0:
say "*BEEP*".
This way I could change StartingTime
(and MicrowaveCountdown
) as much as I want without also having to edit the structure of the “every turn”.