Linking .bb files
Blitz3D Forums/Blitz3D Programming/Linking .bb files
| ||
I am creating a game which will have several different levels etc. Some features will be common to all levels and I can manage these using the include command and functions. What I need to know is , is there a way to call a .bb file from within another. Basically when one level is complete I want to call the second level and clear the world then start with a new one. Otherwise I will end up with a huge unmanageable file while working on it. I know I could probably call each once compiled as an .exe but just wondered if there is another way around this. Perhaps I am going about this the wrong way....any ideas... |
| ||
bb files just contain code... you can't call upon them just include them.... You could split the levels in functions in separate bb files and call the functions. |
| ||
Yeah, try and set up a piece of code that reads data statements and loads in objects, characters, etc. according to the data statements. i.e. Function load_level() Read level_no Read level_mesh Read no_objects For loop=1 To no_objects Read level_object(loop) Read level_objectx(loop) Read level_objecty(loop) Read level_objectz(loop) Next End Function Data 1,"level_1.b3d",3 Data "barrel.b3d",10,0,20 Data "crate.b3d",-3,0,10 Data "desk.b3d",1,0,-6 |
| ||
This sounds like a good way forward, I seem to be ending up with a lot of large one level games. This may be the answer. Cheers |
| ||
Well I am still a bit stuck here.. I seem to be quite good at writing most types of games, FPS, Resident Evil Types etc etc...Trouble is I always end up with one level and struggle to effectively link multiple levels. The DATA idea sounded good but I cannot seem to make it work for me. Because I use a lot of functions I need entities to be global, and I cannot put a global object into a funtion. If I could it would make things a lot easier. Anyone with any ideas either how to make objects global, without them being global if you know what I mean... Or other wasy of linking a lot of levels without becoming a huge mass of dodgy code.... |
| ||
You'll probably just have to load each level seperately. I went through something similar to this while coding my level editor. I originally wanted to make the levels include files but include files get included immediately. Dynamic banks spring to mind. I don't know how to do them but there's been quite a bit of discussion about them. Might even be in the code archives. Hope this helps... Doggie |
| ||
Anyone with any ideas either how to make objects global, without them being global if you know what I mean... Arrays are global by default so if you load all of your objects into arrays like Ross' code above, they will BE global.numObjects = 100 Dim level_object(numObjects) Dim level_objectx(numObjects) Dim level_objecty(numObjects) Dim level_objectz(numObjects) If you really want local variables you can pass them to your functions when your functions are called. Object1 = ; a new object MyFunction(Object1) Function MyFunction(anObjectThatWillBeManipulatedInThisFunction) ;Do something End Function |