going to one level to an other level

Blitz3D Forums/Blitz3D Beginners Area/going to one level to an other level

melonhead(Posted 2011) [#1]
im always having trouble with this i can make a complete level in 3d using 3ds max im always having trouble going to to one level to the next.
more like loading up an other room and able to go back to the other room


im using a 3ds model of a flat door on a wall with a texture im trying to make it so that if you pick up a key you can open the door and go to the next room when you touch the door.

im sorry if i sound like im asking people to program for me but this is really the only way i learn how to program. by using the code over and over until i i know how it works.

each level will be
dung_room_1.bb
dung_room_2.bb
dung_room_3.bb
dung_room_4.bb
thank you !

Last edited 2011


_PJ_(Posted 2011) [#2]
I thionk you need to look at a different way of going about this.
Form the use of ".bb" in your example text above, it looks like you wish to use separate Blitz basic uncompiled script for each level.
This would be really impractical since on compilation, the separation of dependancies is lost. Also, "Include" commands are like compiler directives and as such cannot be affected by the program code in terms of accepting variables or appearing within localised scopes.

However, if you need to keep the separate "levels" in separate files for organisation's sake etc. Then I m,ight recommend heading each file with a Blitz label:
.ROOM_1


This way, dfepending on how your level data is recorded, you may have something like this:

Select (Level)
 Case 1: Restore .ROOM_1
 Case 2: Restore .ROOM_2
 Case 3: Restore .ROOM_3

...



stayne(Posted 2011) [#3]
One way is to use your own LoadRoom() function, UnloadRoom() function and cubes for triggers (same dimensions of door) with alpha set to 0.

If I get time tonight I'll throw together some working code. This is just a VERY simple example.

If EntityCollided(player,Room_1_Trigger)
  UnloadRoom(CurrentRoom)
  LoadRoom(Room_1)
Endif

UnloadRoom(this)
  FreeEntity this
  etc...
End Function

LoadRoom(this)
  If this = Room_1
    CurrentRoom = LoadMesh dung_room_1
  Else If this = Room_2
    CurrentRoom = LoadMesh dung_room_2
  EndIf
  etc...
End Function


Last edited 2011


Ross C(Posted 2011) [#4]
Also, if your rooms aren't big, then load them all.


melonhead(Posted 2011) [#5]
I was thinking about loading it all in I just don't want to clutter the coding up I was also thinking about making one giant map world pluss dungeons as one 3ds file I want the monsters to respond after you leave the room and they can only stay in that room can I still do that with one big model and have the music change from world map to dungeon and back if it easier I'll do it that way