Guest User

Untitled

a guest
Aug 31st, 2012
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.     Basically your leveldata(yourData) is an array with all the info of the tiles(or player, etc.) that
  3.     are in the level for example: a block data could hold x and y coordinate, like [3, 7], this is stored
  4.     in one big array, or a 2D array, which represents the level.
  5. */
  6.  
  7. // In MyEditorManager
  8. override public function blEditLvl(data:ByteArray):void {
  9.     data.position = 0; // to prevent end of file errors
  10.     if(data.length == 0) yourData = emptyLevel(); // if it can't find a level to edit, it will create an empty level
  11.     else yourData = data.readObject(); // else it will read your to be edit level data
  12.     sendEditResult(true, ""); // to send to bl that it is ready to edit the level
  13. }
  14.  
  15. override public function blGetLvlData():void {
  16.     var byte:ByteArray = new ByteArray();
  17.     byte.writeObject(yourData); // storing your leveldata into a byteArray
  18.     sendLvlData(true, byte); // sends the bytearrayy to bl
  19. }  
  20.  
  21.  
  22. // In MyGameManager
  23. override public function blPlayLvl(data:ByteArray, official:Number):void {
  24.     yourData = data.readObject(); // reads your to be played leveldata
  25. }
  26.  
  27. /*
  28.     After you've done this, you still have to make your level with the 'data', for example you could use
  29.     [3, 7] to place a block at coordinate (3, 7)
  30.     This is the same for the editor, you'll have to place the blocks in the editor, but it's basically
  31.     just reading yourData. I hope this was clear enough, if you've any questions, please ask them.
  32. */
Advertisement
Add Comment
Please, Sign In to add comment