I’m trying to check how long it’s been since a user visited my app. This will deduct some points in the app and then a face ( 0r etc) will be shown in a label that shows the apps emotion.
basically the longer the user has been away the sadder the face will look. Anyways my problem is that I don’t know if I’m calling the function correctly each time a day passes.
basically the check variable check variable changes when the user interacts with something in the app, the last day visited is changed to the current day of the month.
The user can also increase the points of the app when they click a button (+10 points)
But i’m now running in more circles then before because i’m not sure how to set the stored variable to check only once each day, do you have any advice? or ideas?
When the functions runs, set a variable to the “current day of the month” (this block can be found in the Device drawer).
To check if the function should run again, compare the variable value to the current day of the month. If they are different values, then run the function.
There are also much more efficient ways to code some of the things in your project… for example, if you have blocks that essentially do this:
If x=1, then set y to 5
If x=2, then set y to 10
if x=3, then set y to 15
if x=4, then set y to 20
…and so on