Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Basically your leveldata(yourData) is an array with all the info of the tiles(or player, etc.)
- that are in the level for example: a block data could hold x and y coordinate, like [3, 7],
- this is stored in one big array, or a 2D array, which represents the level.
- */
- // In MyEditorManager
- override public function blEditLvl(data:ByteArray):void {
- data.position = 0; // to prevent end of file errors
- if(data.length == 0) yourData = emptyLevel();
- // if it can't find a level to edit, it will create an empty level
- else yourData = data.readObject(); // else it will read your to be edit level data
- sendEditResult(true, ""); // to send to bl that the editor is ready to edit the level
- }
- override public function blGetLvlData():void {
- var byte:ByteArray = new ByteArray();
- byte.writeObject(yourData); // storing your leveldata into a byteArray
- sendLvlData(true, byte); // sends the bytearrayy to bl
- }
- // In MyGameManager
- override public function blPlayLvl(data:ByteArray, official:Number):void {
- yourData = data.readObject(); // reads your to be played leveldata
- }
- /*
- After you've done this, you still have to make your level with the 'data',
- for example you could use [3, 7] to place a block at coordinate (3, 7)
- This is the same for the editor, you'll have to place the blocks in the editor,
- but it's basically just reading yourData. I hope this was clear enough.
- If you've anyquestions,please ask them.
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement