Flash Badges
From J2Play
Flash Challenge.getPlayerNumber() > Flash Access Basic User Info > C++ Secure Section > C++ Close the J2Play community wrapper > Flash Badges
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 Leaderboard 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 Score.easySetScore is used or the score type used in the Score.setScore call
- Index: The index of the score in the array of scores you pass to Score.setScore. If you use Score.easySetScore or only submit one score per call to Score.setScore 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
import ca.j2x.flash.util.Map; var properties:Map=new Map();
//Use this line only if a Value Condition is specified //The key is always 40 and the value is the item to compare, ex level1 properties.set("40",<USER'S VALUE>);
//j2play is an ca.j2x.flash.IController; //136 is the id of the event to trigger, this is shown in brackets in the event selector j2play.sendPlatformEvent(j2play.getUsername(),136,properties);
For more information see sendPlatformEvent API
