Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / changing levels

Author
Message
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 5th Aug 2005 01:21
i decided to post this just now even though i don't need to change levels in my game yet, but just so i know.. how would i change a level? I'm using models, would I just delete the model and load up a new one? Would I hide the first one and load another (which would slow down the game)? or what.. thanks

Your signature has been erased by a mod because it's larger than 600x120...
Homey the Clown
21
Years of Service
User Offline
Joined: 4th Apr 2004
Location:
Posted: 5th Aug 2005 04:21 Edited at: 5th Aug 2005 04:22
probably deleting the level. you can also make a function to lessen up the code.


delete the level before calling the function

flip998

"Wow, it's like a panda crapped a rainbow in my brain."
-Captain(Sealab 2021)
master programmer
19
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 5th Aug 2005 05:17
I would just divide your code into three sections (or as many levels as you want).
1. First section, use for main menu
2. Load level 1 material and have its game play have a label like: _level1
3. Load level 2 material and have its game play code, have a label like _level2

By doing that, you can link from one level to the other by deleting all of the objects, then loading a new level in the next gosub. Easy as that. That's what I use.


__________________________________________
<<<<<Check out my sites>>>>>
www.rhettgames.tk | www.slayerbattletanks.tk
Jozers
20
Years of Service
User Offline
Joined: 19th Nov 2004
Location: If I knew I would tell you!!
Posted: 5th Aug 2005 10:52
would this work for a matrix??? I also need to do this in my RPG game when you get to the end of the matrix you then appear on the next matrix.
Thanks
Jozers
master programmer
19
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 5th Aug 2005 11:27
My theory works with that. You just program it to when you get to a certain position you delete all of the objects, reload on a new gosub, thus a new loop, and reposition your character on a new matrix.

I hope that helps you Jozers.

And I hope my theory works for you to Zotoaster.

Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 5th Aug 2005 17:30
alright, so in the main loop when u get to a new level, you just gosub it to delete it? i dont want more that one level to be loaded at the same time

Your signature has been erased by a mod because it's larger than 600x120...
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 6th Aug 2005 00:56 Edited at: 6th Aug 2005 00:58
You just need a bit of planning before you start writing your program.

For example, you could store all the data for building level 1 in a file called Level1.dat (it can still be an ASCII text file).

The data for level 2 would be in Level2.dat and so on. (Store all your levels in a folder called Levels if you like).

In your code, you have a variable called 'Level' and in the LoadLevel procedure in your code you would have something like:

LoadLevel:
Rem Delete current level here
Open To Read 1,"Level"+Str$(Level)+".dat"
Rem Read all your level data in here
Close File 1
Rem Build new level here
Return

When you change levels, alter the value of the Level variable and gosub LoadLevel and the new level will be loaded - regardless of the actual level.

TDK_Man
Homey the Clown
21
Years of Service
User Offline
Joined: 4th Apr 2004
Location:
Posted: 6th Aug 2005 01:01
you can do what they said but turn it into a function. so you dont have to rewrite anything. and then for any scripts or events in the level just have a subroutine like:


flip998

"Wow, it's like a panda crapped a rainbow in my brain."
-Captain(Sealab 2021)
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 6th Aug 2005 01:04
i was thinking that when you go on to the next level, for i microsecond you delete the first one, load up all the new data and load the new level..

Your signature has been erased by a mod because it's larger than 600x120...
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 6th Aug 2005 01:16
Flip998

How can your method be easier?

With what you are suggesting, if there were 50 levels, you need 50 If...Then's! My method needs none.

Zotoaster

That's what my suggestion does.

The line before you load the new level, you freeze the level currently on screen by setting the Camera View to 0,0,1,1. You then update the 3D view, turn the screen back on with Set Camera View 0,0,800,600 and on the next Sync, your new level will just be there.

TDK_Man
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 6th Aug 2005 01:37
good idea, now all i need is a level guy because i cant be assed modelling them

Your signature has been erased by a mod because it's larger than 600x120...
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 9th Aug 2005 14:45
ok doky, it works, now i can actually finish a game

Your signature has been erased by a mod because it's larger than 600x120...
DrewG
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location:
Posted: 25th Aug 2005 21:57
Look it is easy i have made levels and how to get to them in the past do it like this. The code is just an example... just use if then statements to do it. thats how i did my levels

Login to post a reply

Server time is: 2025-05-22 12:46:30
Your offset time is: 2025-05-22 12:46:30