Reference des fonctions
Godot 4 · GDScript · Achievements
check_achievement
Checks whether this player has unlocked a given achievement.
Asynchronous (result via signal)
Signature
check_achievement(achievement_key: String) -> voidWhat it does
POSTs /achievements/check (session-auth). Reports just this player's unlock state for one achievement. unlocked_at is the ISO timestamp when unlocked, or "" while still locked. Emits unlocked=false with unlocked_at="" on error, an empty key, or no active session.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| achievement_key | String | required | The achievement's key from the panel. |
How to call it
Connect achievement_checked first, then call check_achievement().
Result signal: achievement_checked(achievement_key: String, unlocked: bool, unlocked_at: String)
Example
Gamdato.achievement_checked.connect(_on_checked)
Gamdato.check_achievement("first_win")
func _on_checked(key: String, unlocked: bool, unlocked_at: String) -> void:
print("%s unlocked: %s" % [key, unlocked])Use cases
- Decide whether to show an 'already earned' badge before offering to grant it again.
- Gate content or a reward behind a specific achievement being unlocked.