|
|
|||||
BonusLevel docs, Common API (Game+Editor) | ||||||
| ||||||
EditorManager.as and GameManager.as, common API methodsGameManager.as and EditorManager.as are the main classes allowing you to implement the BL API, respectively in your game and in your editor. They provide the methods to call from your swf (game or editor) and the methods called by the API (that you have to extend/implement in your swf). Here are the common methods, that you will find, in the GameManager.as, as well as in the EditorManager.as. cursorOverBLGUI ( ) From the game or the editor to the BL API.
var BLManager=new MyEditorManager(); //or =new MyGameManager(); ... onMouseDown = function () { if (BLManager.cursorOverBLGUI() == false) { //do things } } log ( txt:String , lvl:Number) From the game or the editor to the BL API.
You can call this method to log debug informations.
You can toggle on the Debug Console while playing the game by pressing simultaneously the D and C keys. blWelcome ( ) From the BL API to the game or the editor.
Optional, when this method is called, your game or editor should display the welcome / waiting screen of the application. That means no level is played/edited. showMenu ( cmd:Number ) From the game or the editor to the BL API.
When this function is called, the BL menu shows up. You can use this for example to display a START button on the welcome screen of the game. Example of implementation in AS3:var BLManager=new MyGameManager(); ... myStartButton.addEventListener(MouseEvent.CLICK, click); function click(evt:MouseEvent):void { if (BLManager.cursorOverBLGUI() == false) { BLManager.showMenu(-1); //shows up the menu and the levels to play } } blInit ( ) From the BL API to the game or the editor.
Optional, when this method is called, the BL API is ready (all data initialized). You must implement this method if you want to load extra files, as you can't get the extra files directory before the API is initialized. See below, getExtraPath(). getExtraPath ( ) From the game or the editor to the BL API.
Optional, this method returns the path to the extra files ("extra files" are optional resource files that you can upload from the game submition form). You must wait for the BL API to be initiatlized before calling this method (see above blInit()). Example of implementation in AS3://In the MyGameManager.as or MyEditorManager.as override public function blInit():void { //assuming that we have a method loadResources(path:String). theroot.loadResources(getExtraPath()); } blPause ( ) From the BL API to the game or the editor.
Optional, when this method is called, your game or editor is not displayed anymore, it is running in background. You can make several actions on this event, for example, pause the game, stop the music, as you wish etc... See also below blResume(). blResume ( ) From the BL API to the game or the editor.
Optional, when this method is called, your game or editor is displayed on the foreground. This is called only if blPause() (see above) has been called before. | DevelopersDeveloping games for BLCommunityAPI presentationCommon API (Game+Editor)Game APILevel editor APIDownloadsPlayers & designersFAQ |