Reset System For Laser-Run

Godot Version

4

Question

I am making an FPS game called Laser-Run. I want the players score, level, and rank to reset every month. Is there a way I can do it with written code.

Yes you can do this with code. Just periodically check if a month has passed using one of the datetime functions.

# need to save/load this from a file if locally stored 
var last_datetime_month: int

func has_month_passed() -> bool:
    var current := Time.get_date_dict_from_system()
    return last_datetime_month != current["month"]

func reset_player_month() -> void:
    player_level = 0
    player_score = 0
    player_rank = 0
    var current := Time.get_date_dict_from_system()
    last_datetime_month = current["month"]
    # again save to file if locally stored 
1 Like