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.

Author
Message
Chenak
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 6th Nov 2002 23:32
Hi!
I'm designing a level creator with db pro and i need a bit of help.

So far the level creator can place objects such as floors and walls and create collision boundaries but i can't figure out how to save their positions & object numbers etc onto file (such as .dat or .map). The level creator kind of works like eworld if anyone's heard of that.

Thanks
Once you start down the Dark Path, forever will it dominate your destiny...
GCEclipse
21
Years of Service
User Offline
Joined: 23rd Sep 2002
Location: United Kingdom
Posted: 7th Nov 2002 11:11
Yeh, I think I've heard of E-World. LOL.

Basically how you approach it is to save the cordinates and other relevant details for each object in an array. So if you were saying theres a max of 5000 objects allowed then you'd do something like DIM OBJDATA(5000,4) - this would allow for 5000 objects and 4 elements for each (say x,y,z,and type of object). When you are creating the objects in the editor you record the details in said array.
In addition a possible way to work is to save the details of the no of objects in a Variable lets call it - NoObjs(1). We'll DIM it like: DIM NOOBJS(1) - so it can be used globally.
Again each time you create an object you increment this variable.

Then the saving code:



The next code goes through each element of the array and saves them:


then just close the file CLOSE FILE fileno

to load the data its pretty much the same but in reverse. So first load in the noobjs count and place it in the variable NOOBJS(1):



Or at least thats the approach I would take.

Chenak
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 7th Nov 2002 23:57
Thanks
Thats really helped alot I'll b sure 2 put u in the credits.
The level editor should be up and running very soon i hope!

Thanks again!

Once you start down the Dark Path, forever will it dominate your destiny...
GCEclipse
21
Years of Service
User Offline
Joined: 23rd Sep 2002
Location: United Kingdom
Posted: 8th Nov 2002 00:07
Always happy to help.

Login to post a reply

Server time is: 2024-04-24 14:23:48
Your offset time is: 2024-04-24 14:23:48