DarkBasic Pro Limit Rush by Reverse Reenigne19th Sep 2004 22:08
|
---|
Summary Lesson 2 - Loading The Environment Description In this lesson we discuss loading the game environment (the arena). Thanks to Game Space Light, I was able to convert those pesky .3ds models to .X models. I'm not sure if the failure to load the .3ds files is just an inherent bug in DB Pro but this work around resolves this issue. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com `--------------------------- `Limit Rush `Lesson 02 `--------------------------- `http://www.binarymoon.co.uk `Ben aka Mop `--------------------------- `-------- `INCLUDES `-------- `include the MatEdit LoadMatrix files #include "LoadMatrix.dba" `------ `ARRAYS `------ `declare the MatEdit variables Dim BigMatrix(600,600,1) Dim StartLoc_X(1): Dim StartLoc_Z(1):Dim Info(2) Dim TArrayX(1): Dim TArrayZ(1): Dim FKey(10,1) Dim ColData(100): Dim ZoneData(100): Dim Tiles(500,500) Dim OverTexture$(100): Dim OverName$(20): Dim ReplaceTex(100) Dim MOffsetX(25): Dim MOffsetY(25) Dim MWire(20): Dim MGhost(20): Dim Lock(20) Dim MatX#(20): Dim MatY#(20): Dim MatZ#(20) Dim MatWidth#(20): Dim MatHeight#(20) Dim TilesX(20): Dim TilesZ(20) Dim MatHi#(20): Dim MatLo#(20) `---------------------------------- `Initialize Arena Scaling Variables `---------------------------------- ArenaXYZ_SF = 15000 LightXZ_SF# = .46 LightY_SF# = .55 `set up the program sync on sync rate 40 hide mouse autocam off `load the matrix LoadMatrix("map",1) `temporary load level info load object "media/arena.x",100 load object "media/arena_light.x",101 `scale the arena scale object 100, ArenaXYZ_SF, ArenaXYZ_SF, ArenaXYZ_SF scale object 101, ArenaXYZ_SF*LightXZ_SF#, ArenaXYZ_SF*LightY_SF#, ArenaXYZ_SF*LightXZ_SF# `position arena position object 100,247,188,247 position object 101,247,188,247 `add mip-mapping set matrix texture 1,2,1 set object texture 100,0,1 set object texture 101,2,1 `set fake light properties set object 101,1,1,0,1,0,0,1 ghost object on 101 `set fog properties fog on fog distance 2000 fog color RGB(128,0,0) `set amobient light amount set ambient light 10 `colour main light color light 0,RGB(0,0,160) `make a light make light 1 set point light 1,250,200,250 color light 1,RGB(255,255,100) `--------- `MAIN LOOP `--------- main: do `the following is temporary. There will be more but it will made later `get keyboard input for movement if upkey()=1 then move camera 4 if downkey()=1 then move camera -4 if leftkey()=1 then yrotate camera wrapvalue(camera angle y()-4) if rightkey()=1 then yrotate camera wrapvalue(camera angle y()+4) `sort out the camera height x#=camera position x() z#=camera position z() y#=get ground height(1,x#,z#)+10 ` debug code - show the position of the camera position camera x#,y#,z# text 5,5, "X Position = " + str$(x#) text 5,25, "Y Position = " + str$(y#) text 5,45, "Z Position = " + str$(z#) `update the screen sync loop |