Start the Wavedash SDK when the game is on Wavedash, and make its leaderboards
leaderboards
// at the end of gameInit, with the leaderboards the game posts to
new WavedashPlugin({LEVEL_1: {lowerWins: true, display: 'milliseconds'}, HIGH_SCORE: {}});
wavedash.postScore('LEVEL_1', timeMs);
Each leaderboard's id by its name, once Wavedash
has made or found it, undefined when it could not
Load the value a cloud save slot holds: null when Wavedash says it holds none, undefined when it could not be
loaded or off Wavedash, said in the console on Wavedash
- Do not save over a slot that loaded as undefined, it may hold the player's save; loadFailure(slot) says why
it did: 'notSave' for a file there that is not a save, where a game may offer to start over, 'failed' otherwise
- A saved null loads as null, as an empty slot does
slot numberThe slot number
- Returns
- The value saved, null for none, undefined for a load that failed
const save = await wavedash.cloudLoad(1);
Save a value to one of the player's cloud save slots, kept by Wavedash across devices; off Wavedash it does
nothing
- Any value JSON can hold, stored as the file saves/slot#.json
- Wavedash takes at most 30 saves a minute and 300 an hour from a player, so save at checkpoints, the end of a
level or when asked, not every frame; one over the limit is refused, said in the console
slot numberThe slot number, any whole number the game picks
data *The value to save
- Returns
wavedash.cloudSave(1, {level, coins});
getScores(name, offset, limit, friendsOnly) → Promise<(Array<Object>|undefined)>asyncwavedash.js:217Read a leaderboard's entries, undefined off Wavedash or when it could not be read
name stringThe leaderboard's name
offset number optional, default 0How many entries to skip over
limit number optional, default 10How many entries to read
friendsOnly boolean optional, default falseOnly the player and their friends
- Returns
- The entries, as Wavedash gives them
Read one of the player's stats, 0 for one never set or off Wavedash
name stringThe stat's identifier
Whether the game is on Wavedash, its SDK on the page
Why a slot's last cloudLoad gave undefined: 'notSave' when the slot holds a file that is not a save, where a
game may offer to start over, 'failed' when it could not be loaded, as off Wavedash or on a timeout, where a
game must not save over it; undefined when it loaded a save or found the slot empty, or was not loaded
slot numberThe slot number
Post a score to a leaderboard, Wavedash keeping the player's best; off Wavedash it does nothing
- A leaderboard not in the table given to the plugin is made the first time, higher wins and shown as a number
name stringThe leaderboard's name
score numberA whole number, milliseconds for a time
- Returns
Set what the player is doing, kept with their presence on Wavedash; off Wavedash it does nothing
status string optionalOne line of what they are doing, like 'In a race'
details string optionalMore about it, like 'Lap 2 of 3'; both left out clears it
- Returns
Set one of the player's stats, as made for the game in the Wavedash developer portal, which can unlock an
achievement set to follow it; Wavedash keeps it about a second later, or at once with storeNow; off Wavedash it
does nothing
name stringThe stat's identifier
value numberstoreNow boolean optional, default falseKeep it now, as at the end of a game, not a second later
- Returns