this is actually really easy, and there are many, many ways to do it...but it does take some preplanning...
To have the most flexable system possable...I would look into "scripting" systems...for simplicity sake, you could have a file that describes things about the level...what .B3D model to load for the level, what enemies to load, where to place them inside the level and all that...
Then all you need would be a function to load, read, and execute such scripts...as it does so it resets the game world (frees all existing entities)...Then loads in the new models, textures, and creates the new types of enemies sets everything into the correct location and so on...once done the function returns to the main game loop and the game continues...
For things like level exits and such...have a look at the old Quake level editors...you will find that they allow you to place "entities" in the level...and by assigning these entites special "functions" different things can happen...essentialy, at it's simplest, in your code you create a specific Blitz3D type for each seperate type of action you want to achieve...
like so:
Type EXTlevel
Field PivotID% ; Pivot handle describeing location of this Exit in 3D space
Field SizeX#,SizeY#,SizeZ# ;size of this entity
Field EXTto$ ;file name of script this exit leads to
Field EXTstart$ ;name of start location entity in script file
End Type
Then in your loadlevel() function you phrase through your script...and when you find a section with the appropriate Exit level label you create a new EXTlevel type...create a new Pivot this entity is parent over...use the EXT size values to set up collisions with the player (player sphere to EXT cube)...and set the EXTto and EXTstart strings to the proper values...do the same for each EXTlevel type you find in the script file...
Then as the game is playing you can run through each of these EXTlevel types to see if the player has touched one...if so you then pass that particular EXTlevel/EXTto and EXTlevel/EXTstart strings on to the the loadlevel() function...
To place the camera and such in the proper location once a new level has been started...just use the EXTstart string to phrase through any "PlayerStart" entityes the script file contains for one with the matching name...then move the camera/player to the 3D location it describes...
Sorry if this is confuseing...
|