Playgama
  • Welcome
  • 🚀Quick start
  • Submitting a game
  • Game Requirments
    • 💥Self-check
    • Technical Requirements
    • Advertising Requirements
    • User Experience Requirements
    • Content Requirements
    • Other Requirements
    • Platform-Specific Requirements
  • In-Game Purchases
    • Step-by-step IAP integration guide for Unity
  • FAQ
    • General
    • Submitting a Game
    • Game Moderation
    • Payments and Statistics
  • SDK
    • Getting started
    • Engines
      • Core (Plain JS)
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Unity
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Construct 3
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • GDevelop
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Godot
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Game Maker
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Defold
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
    • Changelog
  • For Partners
    • Getting Started
    • Embed the Widget
      • Adding Games Widget to Your WordPress Site
      • Adding Games Widget to Your Tilda Site
      • Adding Games Widget to Your Framer Site
    • Import the Game Catalog
    • Share your referral link
Powered by GitBook
On this page
  1. SDK
  2. Engines
  3. Godot

Achievements

Achievements in HTML5 games are an exciting and rewarding feature that adds an extra layer of engagement for players. They serve as milestones, celebrating a player's progress, skill, and dedication.

Support

Use this to determine if you can implement achievements for your game on the current platform.

Bridge.achievements.is_supported

Check if getting list of achievements is supported.

Bridge.achievements.is_get_list_supported

Check if built-in popup is supported.

Bridge.achievements.is_native_popup_supported

Unlock achievement

Unlocks achievement for a player.

func _ready():
    var options

    match Bridge.platform.id:
        "y8":
            options = {
                "achievementkey": "YOUR_ACHIEVEMENT_KEY",
                "achievement": "YOUR_ACHIEVEMENT_NAME"
            }
        "lagged":
            options = {
                "achievement": "YOUR_LEADERBOARD_ID",
            }

    Bridge.achievements.unlock(options, funcref(self, "_on_unlock_completed"))

func _on_unlock_completed(success):
    print(success)
func _ready():
    var options

    match Bridge.platform.id:
        "y8":
            options = {
                "achievementkey": "YOUR_ACHIEVEMENT_KEY",
                "achievement": "YOUR_ACHIEVEMENT_NAME"
            }
        "lagged":
            options = {
                "achievement": "YOUR_LEADERBOARD_ID",
            }

    Bridge.achievements.unlock(options, Callable(self, "_on_unlock_completed"))

func _on_unlock_completed(success):
    print(success)

Get List

Returns the achievement list in JSON

func _on_get_list_button_pressed():
    var options
    
    Bridge.achievements.get_list(options, funcref(self, "_on_get_list_completed"))

func _on_get_list_completed(success, list):
    print(success)
    
    match Bridge.platform.id:
        "y8":
            for item in list:
                print("achievementid:" + str(item.achievementid))
                print("achievement:" + str(item.achievement))
                print("achievementkey:" + str(item.achievementkey))
                print("description:" + str(item.description))
                print("icon:" + str(item.icon))
                print("difficulty:" + str(item.difficulty))
                print("secret:" + str(item.secret))
                print("awarded:" + str(item.awarded))
                print("game:" + str(item.game))
                print("link:" + str(item.link))
                print("playerid:" + str(item.playerid))
                print("playername:" + str(item.playername))
                print("lastupdated:" + str(item.lastupdated))
                print("date:" + str(item.date))
                print("rdate:" + str(item.rdate))
func _on_get_list_button_pressed():
    var options
    
    Bridge.achievements.get_list(options, Callable(self, "_on_get_list_completed"))

func _on_get_list_completed(success, list):
    print(success)
    
    match Bridge.platform.id:
        "y8":
            for item in list:
                print("achievementid:" + str(item.achievementid))
                print("achievement:" + str(item.achievement))
                print("achievementkey:" + str(item.achievementkey))
                print("description:" + str(item.description))
                print("icon:" + str(item.icon))
                print("difficulty:" + str(item.difficulty))
                print("secret:" + str(item.secret))
                print("awarded:" + str(item.awarded))
                print("game:" + str(item.game))
                print("link:" + str(item.link))
                print("playerid:" + str(item.playerid))
                print("playername:" + str(item.playername))
                print("lastupdated:" + str(item.lastupdated))
                print("date:" + str(item.date))
                print("rdate:" + str(item.rdate))

Show Native Popup

Some platforms support built-in achievement list which is shown in overlay

func _on_show_native_popup_button_pressed():
    var options
    
    Bridge.achievements.show_native_popup(options, funcref(self, "_on_show_native_popup_completed"))

func _on_show_native_popup_completed(success):
    print(success)
func _on_show_native_popup_button_pressed():
    var options
    
    Bridge.achievements.show_native_popup(options, Callable(self, "_on_show_native_popup_completed"))

func _on_show_native_popup_completed(success):
    print(success)
PreviousLeaderboardsNextIn-Game Purchases

Last updated 5 months ago