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.

Newcomers DBPro Corner / how do i make individual levels?

Author
Message
hpfan273
17
Years of Service
User Offline
Joined: 19th Jan 2007
Location:
Posted: 23rd Jan 2007 04:05
how do i make individual levesls???

i kinda know... but n e wayz... here is my code:

[code
`the start...
autocam off
sync on
sync rate 60
hide mouse

`make a player object
gosub _speler

`make a simple level
gosub _level1

rem Main loop
do

`movement
if upkey()=1 then move object 1,0.8
if leftkey()=1 then yrotate object 1,wrapvalue(object angle y(1)-2.5)
if rightkey()=1 then yrotate object 1,wrapvalue(object angle y(1)+2.5)
if spacekey()=1 and playergrav#=0.0 then playergrav#=2.0

rem Use camera tracker to follow player object
`change these parameters for other camera positions
angle#=object angle y(1)
camdist#=25.0 : camhigh#=posy#+8.0 : camfade#=3.5
set camera to follow posx#,posy#,posz#,angle#,camdist#,camhigh#,camfade#,1

`player position
posx#=object position x(1)
posy#=object position y(1)
posz#=object position z(1)

`camera position
cposx#=camera position x()
cposy#=camera position y()
cposz#=camera position z()
position object 2,cposx#,cposy#,cposz#

rem Handle a touch of gravity
playergrav#=playergrav#-0.1
posy#=posy#+playergrav#

rem Handle sliding collision for player object with other objects
position object 1,posx#,posy#,posz#
if object collision(1,0)>0
dec posx#,get object collision x()
dec posy#,get object collision y()
dec posz#,get object collision z()
if get object collision y()<0 then playergrav#=0.0
endif

rem camera collision
if object collision(2,0)>0
dec cposx#,get object collision x()
dec cposy#,get object collision y()
dec cposz#,get object collision z()
endif
position object 2,cposx#,cposy#,cposz#
position camera cposx#,cposy#,cposz#

rem Update with new object position
position object 1,posx#,posy#,posz#

rem Tilt camera down a little
xrotate camera 15

rem Update screen
sync

rem End loop
loop

`maak de speler
_speler:
make object box 1,10,10,10
color object 1,rgb(255,0,255)
position object 1,0,0,0
make object collision box 1,-5,-5,-5,5,5,5,0

`en het object voor de camera
make object cube 2,1
make object collision box 2,-0.5,-0.5,-0.5,0.5,0.5,0.5,0
hide object 2

return

`maak level 1
_level1:

`the floor
make object box 100,1000,10,1000
position object 100,0,-20,0
color object 100,rgb((0),(0),(0))
make object collision box 100,-500,-5,-500,500,5,500,0

rem Create fog (if supported)
fog on
fog color 0
fog distance 100

`some boxes and platforms
for t=502 to 507
make object box t,20,5,20
position object t,-100+(t-502)*35,-5+(t-502)*3,100
color object t,rgb((255),(255),(255))
make object collision box t,-10,-2.5,-10,10,2.5,10,0
next t

make object box 508,20,5,20
position object 508,75,15,135
color object 508,rgb((255),(255),(255))
make object collision box 508,-10,-2.5,-10,10,2.5,10,0

make object box 509,20,5,20
position object 509,75,20,170
color object 509,rgb((255),(255),(255))
make object collision box 509,-10,-2.5,-10,10,2.5,10,0

make object box 510,20,5,20
position object 510,75,25,205
color object 510,rgb((255),(255),(255))
make object collision box 510,-10,-2.5,-10,10,2.5,10,0

make object box 511,20,5,20
position object 511,75,30,240
color object 511,rgb((255),(255),(255))
make object collision box 511,-10,-2.5,-10,10,2.5,10,0

make object box 501,20,5,20
position object 501,75,35,275
color object 501,rgb((255),(255),(255))
make object collision box 501,-10,-2.5,-10,10,2.5,10,0

make object box 500,20,5,20
position object 500,40,40,275
color object 500,rgb((255),(255),(255))
make object collision box 500,-10,-2.5,-10,10,2.5,10,0

make object box 499,20,5,20
position object 499,5,45,275
color object 499,rgb((255),(255),(255))
make object collision box 499,-10,-2.5,-10,10,2.5,10,0

make object box 498,20,5,20
position object 498,-30,50,275
color object 498,rgb((255),(255),(255))
make object collision box 498,-10,-2.5,-10,10,2.5,10,0

make object box 497,20,5,20
position object 497,-65,55,275
color object 497,rgb((255),(255),(255))
make object collision box 497,-10,-2.5,-10,10,2.5,10,0

make object box 496,20,5,20
position object 496,-100,60,275
color object 496,rgb((255),(255),(255))
make object collision box 496,-10,-2.5,-10,10,2.5,10,0

make object box 495,20,5,20
position object 495,-100,65,240
color object 495,rgb((255),(255),(255))
make object collision box 495,-10,-2.5,-10,10,2.5,10,0

make object box 494,20,5,20
position object 494,-100,70,205
color object 494,rgb((255),(255),(255))
make object collision box 494,-10,-2.5,-10,10,2.5,10,0

make object box 493,20,5,20
position object 493,-100,75,170
color object 493,rgb((255),(255),(255))
make object collision box 493,-10,-2.5,-10,10,2.5,10,0

make object box 492,20,5,20
position object 492,-100,65,310
color object 492,rgb((255),(255),(255))
make object collision box 492,-10,-2.5,-10,10,2.5,10,0

make object box 491,20,5,20
position object 491,-100,70,345
color object 491,rgb((255),(255),(255))
make object collision box 491,-10,-2.5,-10,10,2.5,10,0

make object box 490,20,5,20
position object 490,-100,75,380
color object 490,rgb((255),(255),(255))
make object collision box 490,-10,-2.5,-10,10,2.5,10,0

make object box 489,20,5,20
position object 489,-65,80,380
color object 489,rgb((255),(255),(255))
make object collision box 489,-10,-2.5,-10,10,2.5,10,0

make object box 488,20,5,20
position object 488,-30,85,380
color object 488,rgb((255),(255),(255))
make object collision box 488,-10,-2.5,-10,10,2.5,10,0

make object box 487,20,5,20
position object 487,5,90,380
color object 487,rgb((255),(255),(255))
make object collision box 487,-10,-2.5,-10,10,2.5,10,0

make object box 486,20,5,20
position object 486,40,95,380
color object 486,rgb((255),(255),(255))
make object collision box 486,-10,-2.5,-10,10,2.5,10,0

make object box 485,20,5,20
position object 485,75,100,380
color object 485,rgb((255),(255),(255))
make object collision box 485,-10,-2.5,-10,10,2.5,10,0

make object box 484,100,5,100
position object 484,75,105,310
color object 484,rgb((255),(255),(255))
make object collision box 484,-50,-2.5,-50,50,2.5,50,0

make object box 483,10,10,10
position object 483,75,130,310
load image "finish.bmp",1
texture object 483,1
make object collision box 483,-5,-5,-5,5,5,5,0

`and walls around the scene
for t=0 to 1
make object box t+512,10,50000,500
position object t+512,-200+t*400,5,220
color object t+512,rgb((0),(0),(0))
make object collision box t+512,-5,-20,-250,5,20,250,0
make object box t+514,400,50000,10
position object t+514,0,5,-30+t*500
color object t+514,rgb((0),(0),(0))
make object collision box t+514,-200,-20,-5,200,20,5,0
next t

return

THANKS FOR STOPING AT A RED LIGHT... AND LETTING ME CRASH INTO YOU AT 80 MILES AN HOUR!!!
Kieran
18
Years of Service
User Offline
Joined: 6th Aug 2006
Location: Hamilton, New Zealand
Posted: 23rd Jan 2007 04:13
Well this may not suit your code but to create a new level you have to remove all the current media eg. The level, Monsters, trees all that kind of stuff and the camera the load all the level 2 stuff like the maps and players then position the player to the start of the map. then you need to have a different main program loop for the second level.

Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 23rd Jan 2007 06:03
You really shouldn't create an entire level using DBP primitives . You should get a world builder like 3DWS, it makes it a lot easier in every aspect. Trust me, I used to do what your doing, and you'll regret that you spent time doing it, when what's taking you a long time will only take a matter of minutes with a world builder. As for loading levels, it is much more complicated with what you have, as you'd have to run through and delete all the objects, and load the new ones, as opposed to deleting one object made in a world builder, the whole level.

Pirates of Port Royale
Live the life of a pirate.
Uncle Sam
19
Years of Service
User Offline
Joined: 23rd Jul 2005
Location: West Coast, USA
Posted: 23rd Jan 2007 21:32 Edited at: 23rd Jan 2007 21:34
I agree with Gil, I used to do that too.

Go to http://www.vector3r.com and get mapscape v1.0...Evolved just released it for free. I havn't tested the models in DBC but they should work.

Once you have made say 3 levels or so, you can just do something like this:

gosub Load_Level_1

So after that, you have the DO/LOOP with all of your code inside of it for the gameplay, and then when you want to set a new level, you call a function like this:

Clear_Level()

The function would look something like:

function Clear_Level()
delete object [world_object]
delete object [sky_object]
delete [enemies]
delete [player]
etc.......
endfunction

Then, once the world is cleared, simply type:

gosub Load_Level_2

And there you have it! Whenever you want to clear the level, just type Clear_Level(), then load the level you want.

Good luck.

Uncle Sam
Nvidia Geforce 7950GT 512MB PCIEx, 2.66 GHZ Pentium 4 proccessor, 1GB RAM
Need particles? Click here!
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 23rd Jan 2007 21:40
I made a scripting system once that I could use to make my levels externally, i.e. make cubes and position them, but in a file. So it was really easy to actually load a level, just did loadMap(file$). I then made a deleteMap() function which deleted it, and then did loadMap() again. Look in my threads for my scripting system

Here's how my levels looked in a file:


hpfan273
17
Years of Service
User Offline
Joined: 19th Jan 2007
Location:
Posted: 24th Jan 2007 03:15
thank u guys.... ima use uncle sams way of making them... thank you

THANKS FOR STOPING AT A RED LIGHT... AND LETTING ME CRASH INTO YOU AT 80 MILES AN HOUR!!!
hpfan273
17
Years of Service
User Offline
Joined: 19th Jan 2007
Location:
Posted: 24th Jan 2007 03:55
uncle sam: it won't let me save the models

THANKS FOR STOPING AT A RED LIGHT... AND LETTING ME CRASH INTO YOU AT 80 MILES AN HOUR!!!

Login to post a reply

Server time is: 2024-09-25 17:20:03
Your offset time is: 2024-09-25 17:20:03