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 / read/write to/from files

Author
Message
bipolar games
19
Years of Service
User Offline
Joined: 12th Jul 2005
Location: Lacey, Washington
Posted: 12th Jul 2005 13:30
I am making a level editor that needs to be able to read and write letters and numbers from a .lvl file (this is just a text file with .lvl instead of .txt). The level code looks somthing like this:

1111111
1033301
1010101
11ABC11
1200021
120D021
1111111

I need to read each letter/number from left to right, top to bottom, one by one. I also need to write the same way. I would like to be able to read/write specific x/y of the level code grid, aka change the 0 on the second row to an E on command. Can someone help me with this?

Bipolar Games - coming to a website near you!
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 12th Jul 2005 18:28 Edited at: 12th Jul 2005 18:29
I am sleepy ATM but maybe someone will help you. If not it will be another 24hours before I can look at it again. I can tell you a couple of things I would do.

As far as reading left to right, top to bottom: you can just use read string command to get each line and then use the mid$ command to extract each character.

The writing to a specific location in the file is a bit trickier. If you know the xact contents of the file already then you can use the skip bytes command to skip to that loaction in the file and change it. Otherwise get ready to learn some memblock programming and use meak memblock from file. It will then be easier and faster to read and write data.

bipolar games
19
Years of Service
User Offline
Joined: 12th Jul 2005
Location: Lacey, Washington
Posted: 13th Jul 2005 02:01
I was thinking, would it be easier to load and save a arrays to/from files? I don't know much about arrays, but I am now reading the manual to try to figure it out.

Bipolar Games - coming to a website near you!
bipolar games
19
Years of Service
User Offline
Joined: 12th Jul 2005
Location: Lacey, Washington
Posted: 13th Jul 2005 02:33
Ok, I've started testing arrays, and I found out that they save them encrypted. This is a problem because I need to be able to get into the files and change the arrays as needed. Oh, and my levels are going to be 40x25 each, so maybe arrays aren't the best answer.

Bipolar Games - coming to a website near you!
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 13th Jul 2005 20:37
Teehee, I was just making a map-maker program (DBP).

Feel free to use it. Right now, you can make maps (ofcourse), resize, load, choose between 9 tiles and 2 tools.

Hey, that's an idea! Adding characters as tiles... Thx



Immunity and Annihalation makes Immunihalation...
Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 16th Jul 2005 10:45
Sven B.

This is really a nice level editor but I think it would do better if you could use your own custom colors instead of the preset ones and if you could import your own square textures.

Just do something like this after the user enters in a file to use.



That way the textures would always be square.

Formerly known as SFLM.
BearCDPOLD
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 16th Jul 2005 19:31 Edited at: 16th Jul 2005 19:32
Dunno about Pro, but arraysin Classic will save encrypted as long as they are not string arrays.

Crazy Donut Productions
Current Project: A Redneck game
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 16th Jul 2005 20:41
Yes, I had that request of using sprites as tiles. But, since you can zoom out until each grid square is 1px heigh and width, this would be very unhandy. The option to choose your own color values is a nice idea though, and thus I will work on it.

Here's an updatet version of map-maker with more features:



Immunity and Annihalation makes Immunihalation...

Login to post a reply

Server time is: 2024-11-27 22:30:06
Your offset time is: 2024-11-27 22:30:06