|
|
|||||
BonusLevel docs, Game API | ||||||
| ||||||
GameManager.as, specific functionsblPlayLvl ( data: as2 String as3 ByteArray , official: Number ) From the BL API to the game.
When this method is called, you are supposed to unserialize the data (contained in data) and to start playing the level corresponding to this data. official may contain 4 different values. This parameter might be useful only when the game manages resources (gold, items, powerups, lives etc...) from a level to another (implementing the "User data management", see below).
Advanced : If the level data is very heavy to unserialize, it might be interesting to split the workload over several frames not to stop the animations arounds (animations of the BL graphics interface). lvlCompleted ( completed:Boolean , score:Number ) From the game to the BL API.
This function must be called after the player has completed the current level. When completed is true, the BL interface propose to play the next level. Actually calling this function with completed equal to false, will result in playing again the same level.
blCatWin ( ) From the BL API to the game or the editor.
Optional, The method is called when the player has completed all the levels of one of the categories you has configured for your game. You can show, for example, an animation to reward the player. blWin ( ) From the BL API to the game or the editor.
Optional, The method is called when the player has completed all the levels of the game. You can show, for example, an animation to reward the player. User data management - OptionalThe game engine can implement (or not) the "User data management". requestUserData ( ) From the the game to the BL API.
A game implementing the "User data management", should call this function right after the game is loaded. This informs the BL API that we want to receive the current player data and also the new player data each time the player slot changes (player 1, player 2 etc...). blNewUserData ( res: Boolean , data: as2 String as3 ByteArray ) From the BL API to the game.
This method is called by the API if you have subscribed to player data notification. It's called the first time after you call requestUserData() and then each time the player slot changes( player 1, player 2 etc...) updateUserData ( data: as2 String as3 ByteArray ) From the the game to the BL API.
The game engine call this method to save the serialized user data, after a level is successfully competed for example. The user data is only depending on your game but, usually, the new items, powerups, etc..., acquired during a level should be saved only if it is an official level and the first time the player complete it. You can understand now the goal of the official parameter in the blPlayLvl method described above. userDataUpdatedCbk ( res: Boolean , data: String ) From the BL API to the game.
The callback of the updateUserData call. If res==true, the user data was successfully stored, otherwise, data contains an error message. | DevelopersDeveloping games for BLCommunityAPI presentationCommon API (Game+Editor)Game APILevel editor APIDownloadsPlayers & designersFAQ |