You have a game + editor ready and you want to insert the BL API ?
- You have to implement the API in both the game engine and the editor.
- Download the archive containing the Game API + Editor API corresponding to your actionscript version.
- Uncompress the files into the same directory as your .fla files.
- In the first frame of your game and editor, add var BLManager:MyXxxxManager = MyXxxxManager(this); (Xxxx=Game or Xxxx=Editor). This is your BL manager, that receives comands from the BL user interface (typically, a command is sent from the BL interface to the XxxxManager.as, when a user want to play or to a level).
- Don't modify XxxxManager.as, only MyXxxxManager.as.
- GameManager.as is the API dedicated to the game engine and EditorManager.as is the API dedicated to the level editor. You implement the API by overriding some of the methods of XxxxManager.as, into MyXxxxManager.as.
- You should start to implement blEditLvl ( data: as2 String as3 ByteArray ) for the editor. Then blGetLvlData ( ). Once this is done you can start editing a level. Save it to the server and reload it to modify it.
- At this stage you can submit your editor to the site (with a fake game engine). You will not be able to play the game but you can test the editor (create new levels, save them, reload them, modify them).
- You should start to implement blPlayLvl ( data: as2 String as3 ByteArray , official: Number ) for the game engine. Once this is done you can play a level in the game engine.
- At this stage you can submit your game to the site. You will be able to test the game engine on the levels you have created with the editor.
- Then you should call lvlCompleted ( completed:Boolean , score:Number ). Then your game engine is ready to save scores.
- After this, you can override other important but not necessary methods (blInit, blWelcome, blWin, blCatWin) and use additional methods of the API (cursorOverBLGUI, getExtraPath).
- You can download the Examples to see a working implementation, and to grab some interesting additional classes.
Working with the examples
- Three (3) basic examples are provided. editor_example1.fla (a text editor), game_example1.fla (simple game API implementation) and game_example2.fla (an example of game implementating the "User data API"). Note that on all examples, we instantiate the XxxxManager.as object (Xxxx=Game or Xxxx=Editor) on the first frame of the swf (game or editor). All BL API implementations rely on this object, and the name of the variable must be always BLManager.
- The LevelData.as class is used by both the editor (to unserialize de level data) and the editor (to unserialize AND serialize the level data).
- For the Actionscript 2 package, a basic Serializer.as class is provided that behaves like the native ByteArray AS3 class (writeString() readString() writeNumber() readNumber()).
- Three (3) methods are overrided and 1 method is called for the basic implementation (game_example1.fla and editor_example1.fla).
- MyGameManager.as is an example of a class extending the GameManager.as class, and implementing the game API. You must develop a similar class for your own game or modify this one.
- MyEditorManager.as is an example of a class extending the EditorManager.as class, and implementing the editor API. You must develop a similar for your own editor or modify this one.
- Once the methods in MyGameManager.as and MyEditorManager.as have been implemented, you have a minimal implementation of the BL API, and you can submit your game for the first testings.
- The examples in the archive are using custom buttons that will show you how to use XxxxManager.cursorOverBLGUI() and BLManager.addListener() to check if the mouse cursor is over the BL graphic user interface (a popup, a loading panel etc...), before triggering an action on mouse button click.
- MyUserDataGameManager.as is an advanced example of a class extending the MyGameManager.as class (and thus GameManager.as also), and implementing the game API with user data management. This class is used with game_example2.fla.
Actionscript 2 (Flash 8 and Flash MX2004), downloads
Actionscript 3 (Flash 9 CSS3 and over), downloads
Contact us for more support
Players & designers