I have two gloal variables and a button. when i click the button increase "a" variable to 1 and increase "b" variable to 10. every 1 second subtract "b" 1 and every 10 second subtract "a" 1 .
So i click button 4 times then "a"=4 ,"b"=40 . I save this data n localstorage and after 6 second i exit the game . when I' back : "a"= 4 and "b"= 34 . In another word : "b"=34 when i'm back, after 4 second "b"=30 , and then subtract from "a" 1.
or : "a"=6 "b"=60 , 8seconds lef "b"=52, after 2 second should "a"=5.