C++ Badges
From J2Play
Contents |
Enabling Badges
To enable badges follow these steps
- 1. Edit your game in the J2Play Management Console and select the Game tab
- 2. Under Integrated features make sure that badges is checked
- Please allow 1 hour for all badge additions and updates to full propagate through the system
Adding Badges
Score Badges (requires Leaderboards integration)
These are badges that are awarded based on a user's score. For example when someone wins twenty games, or achieves a score greater than five thousand.
To add these to badges to game follow these steps
- 1. Integrate Leaderboards
- 2. Edit your game in the J2Play Management Console and select the Badge tab
- 3. Click Add Badge to Game
- 4. Entering in a name, description and how many credits are awarded to the user
- 5. Under badge condition select Score
- 6. Enter in the condition you want to trigger the badge
- Score Type: Either Record if ScoreController::EasySetScore() is used or the score type used in the [C++ ScoreController::EasySetScore()|ScoreController::EasySetScore()]] call
- Index: The index of the score in the array of scores you pass to ScoreController::SetScores(). If you use ScoreController::EasySetScore() or only submit one score per call to ScoreController::SetScores() leave this as 0
- Operator: The comparison of the badge condition. Reads as the submitted score operation (greater than, less than, equal to) Value
- Value: The number to check the submitted score against ex. submitted score is greater than 0
Custom Event Badges
These are badges that the game can trigger on custom events in the game like completing a level or in the game.
To add these to badges to game follow these steps
- 1. Edit your game in the J2Play Management Console and select the Badge tab
- 2. Click Add Badge to Game
- 3. Entering in a name, description and how many credits are awarded to the user
- 4. Under badge condition select Custom Event
- 5. Enter in the condition you want to trigger the badge
- Event: Choose an existing event or enter in a name for the event you wish to create
- Number of occurrences: The number of times the game needs to send the event for the user before the user gets the badge
- Value condition: This is an optional field that allows the game to specify a condition based on a value passed into the event call ex. the value is greater than 10 or the value equals 'level1'
- For example a badge which is awarded when a player completes the first level might be associated with the Complete Level event, have a occurrence number of one, and a condition of value = 'level1'
- If you wish to add more than one condition to the badge contact J2Play Developer Support for assistance
Example
std::map prop; prop.insert(std::pair(40,<USER'S VALUE>)); CGDKInstance::GetInstance()->sendPlatformEvent(10000, NULL, J2PlayController::instance()->getUserName(), 120, prop);
For more information see GDKInstance::sendPlatformEvent
