I am using Unity but this is an issue, that can be applied to every programming language.
I only have one Update-Function.
function Update ()
{
}
This function runs each frame. If I want to include a history, like "Has player already been at x, show z, else show g" I work with
function Update ()
{
if(playerwasatx == true)
{
showz = true;
}
else
{
showg = true;
}
if (showg == true)
...
if (showz == true)
...
}
You get the idea. Losing track is just too easy. Which approach helps me include a history, like an animation to be played.
For instance(pseudocode)
task1: if player is at z, play animation xy smoothly. If something interrupts animation xy by entering object u's space, do m
task2: if it's already night in the game(night == true), move person a to position b, then let him wait there for a certain amount of time(time = x) until night is false again.
All of this can be solved with if then else but to not lose track, which approach is more human friendly?