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 / 3D breakout

Author
Message
NachoMan
22
Years of Service
User Offline
Joined: 14th Apr 2003
Location: United Kingdom
Posted: 30th Apr 2003 23:49
i have an array which will determine the block types for each block on each level. It ends up being over 1000 lines! cos there are 10 levels each with 100 block spaces.
dim block(10,10)
block(1,1) = 5
block(1,2) = 7
etc down to
block(10,10) = 1
that for 10 levels! it gets a little repetitive, I have seen people store data in one line separated by commas, how do you do this and how do you extract the relevant data?
Hamish McHaggis
22
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 30th Apr 2003 23:54
store the data using

data 1,2,3,4,5,56,6,7,8,3,53,45,34,52345,345,345
etc

then you can read the data in using

read block(1,1)

This will read the first number on the list into block(1,1). That piece of data is now used up and the next time you use the read command, it will read the next piece of data into the variable.

Why the hell'd you ask me for crying out loud!?!

Athelon XP 1400 Plus - Nvidia Geforce MX400 - 256mb RAM
NachoMan
22
Years of Service
User Offline
Joined: 14th Apr 2003
Location: United Kingdom
Posted: 1st May 2003 19:45
cool! thanks a lot. that makes it ..... um 35 lines in stead of over 1000!!!!
Pricey
22
Years of Service
User Offline
Joined: 22nd Feb 2003
Location:
Posted: 4th May 2003 16:22
why not use a for loop for the loading bit like:

FOR L = 1 TO 10
READ BLOCKS(1,L)
NEXT L

that would make it less, or would it?

[age 11]

NachoMan
22
Years of Service
User Offline
Joined: 14th Apr 2003
Location: United Kingdom
Posted: 4th May 2003 16:47
yeah, that's how i did it. if u want to know everything:
for a = 1 to 10
for b = 1 to 10
read block(a,b)
next b
next a

Login to post a reply

Server time is: 2025-05-17 09:33:00
Your offset time is: 2025-05-17 09:33:00