I'm currently in the process of creating a Tamogochi type game, and I'm trying to nail down the mechanic where the program calculates how much time has passed since you've closed the game and subtracts from your pet's stats accordingly. However, every time I get the function I made to trigger it just sets everything back to zero and messes up my hygiene mechanic.
Does anyone have any suggestions on how to properly create this mechanic?