SHOW:
|
|
- or go back to the newest paste.
1 | /* | |
2 | Basically your leveldata(yourData) is an array with all the info of the tiles(or player, etc.) | |
3 | that are in the level for example: a block data could hold x and y coordinate, like [3, 7], | |
4 | this is stored 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(); | |
11 | // if it can't find a level to edit, it will create an empty level | |
12 | else yourData = data.readObject(); // else it will read your to be edit level data | |
13 | sendEditResult(true, ""); // to send to bl that the editor is ready to edit the level | |
14 | } | |
15 | ||
16 | override public function blGetLvlData():void { | |
17 | var byte:ByteArray = new ByteArray(); | |
18 | byte.writeObject(yourData); // storing your leveldata into a byteArray | |
19 | sendLvlData(true, byte); // sends the bytearrayy to bl | |
20 | } | |
21 | ||
22 | ||
23 | // In MyGameManager | |
24 | override public function blPlayLvl(data:ByteArray, official:Number):void { | |
25 | yourData = data.readObject(); // reads your to be played leveldata | |
26 | } | |
27 | ||
28 | /* | |
29 | - | After you've done this, you still have to make your level with the 'data', for example you could use |
29 | + | After you've done this, you still have to make your level with the 'data', |
30 | - | [3, 7] to place a block at coordinate (3, 7) |
30 | + | for example you could use [3, 7] to place a block at coordinate (3, 7) |
31 | - | This is the same for the editor, you'll have to place the blocks in the editor, but it's basically |
31 | + | This is the same for the editor, you'll have to place the blocks in the editor, |
32 | - | just reading yourData. I hope this was clear enough, if you've any questions, please ask them. |
32 | + | but it's basically just reading yourData. I hope this was clear enough. |
33 | If you've anyquestions,please ask them. | |
34 | */ |