Skip to content

Game

The game module contains various functionality related to the game.

Happy time

The happytime() method can be called on various player achievements (beating a boss, reaching a highscore, etc.). It makes the website celebrate (for example by launching some confetti). There is no need to call this when a level is completed, or an item is obtained.

SDK.game.happytime()

Gameplay start/stop

We provide functions that enable us to track when and how users are playing your games. These can be used to ensure our site does not perform resource intensive actions while a user is playing.

The gameplayStart() function has to be called whenever the player starts playing or resumes playing after a break (menu/loading/achievement screen, game paused, etc.).

The gameplayStop() function has to be called on every game break (entering a menu, switching level, pausing the game, ...) don't forget to call gameplayStart() when the gameplay resumes.

# player pauses the game
SDK.game.gameplayStop()
# player resumes the game
SDK.game.gameplayStart()

Game loading start/stop

We provide functions that enable us to track when and how long the loading of your game takes.

The sdkGameLoadingStart() function has to be called whenever you start loading your game.

The sdkGameLoadingStop() function has to be called when the loading is complete and eventually the gameplay starts.

# Game starts loading
SDK.game.sdkGameLoadingStart()
# Loading...
SDK.game.sdkGameLoadingStop()