With the use of sequences in the game it was necessary for me to work out a way to save the state of each sequence so that, for example, the basement sequence once completed would load as completed when the game was restarted after that point. 2 simple variables were added to the saveState function; paused and headpos. These allow the game to remember if the sequence is paused and at what frame the sequence was at.
Using the sequence did bring up one bug. Once it’s completed it is supposed to fire another trigger for the next event for the player to deal with. I had forgotten this and so the event was triggering regardless of whether the player had already resolved the problem it was going to create.
It’s these knock on effects that make coding that bit more fun. You tweak feature A and without realising has messed up feature B. Constant playthroughs and trying different routes help isolate and locate these irritations.