Well I changed the code to make it read faster...all I did was make a repeat until file end loop (Thanks a ton for the tut TDK, you are AWESOME!).
So here is the new read file code.
Inc Level,1
File_Name$="Levels"+str$(Level)
if file exist(File_Name$)=1
open to read 1,File_Name$
x=8
repeat
read string 1,Value$
If Value$ = "0" or Value$ = "1"
Blocks(x) = val(Value$)
else
dec x,1
endif
inc x,1
until file end(1)=1
x=8
repeat
read string 1,Value$
If Left$(Value$,1) = "R"
CharactersR = Len(Value$)-2
BlocksR(x) = val(right$(Value$,CharactersR))
else
Dec x,1
endif
inc x,1
until file end(1)=1
x=8
repeat
read string 1,Value$
If Left$(Value$,1) = "G"
CharactersG = Len(Value$)-2
BlocksG(x) = val(right$(Value$,CharactersG))
else
Dec x,1
endif
inc x,1
until file end(1)=1
x=8
repeat
read string 1,Value$
If Left$(Value$,1) = "B"
CharactersB = Len(Value$)-2
BlocksB(x) = val(right$(Value$,CharactersB))
else
Dec x,1
endif
inc x,1
until file end(1)=1
close file 1
else
end
endif
That is what I'm doing...first loop:reading to see if the current line is a block or not
Second loop:determine the red value, if 0 is the color then it creates a random color for it.
Third loop:same as red except for green
Fourth loop: same as red except for blue.
The new file for level 1, I realized it was working correctly but incorrectly at the same time. It was working correctly for the fact that I specified each one as 0 -_-
So here is the new file 1:
1
R=255
G=255
B=255
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
G=0
B=0
1
R=0
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
If Blocks(a) = 0
Sprite a,650,650,a
inc xpos,64
dec TotalBricks#,1
dec TotalBricks2#,1
else
If BlocksR(a) = 0
BlocksR(a) = rnd(255)
endif
If BlocksG(a) = 0
BlocksG(a) = rnd(255)
endif
If BlocksB(a) = 0
BlocksB(a) = rnd(255)
endif
R = BlocksR(a)
G = BlocksG(a)
B = BlocksB(a)
set sprite diffuse a,R,G,B
Sprite a,xpos,ypos,a
inc xpos,64
endif
If xpos = 640
dec xpos,640
inc ypos,16
endif
inc a,1
until a = TotalBricks2
gosub Game_Start
return
EDIT:Tried that and it won't work...it doesn't print anything to the screen. When I put it to display what BlocksR(8) (which should be 255 from what my code is like with my file) and it displays a random number everytime.
EDIT2
k, I figured it out, I had to close the file and re-open it before and after every loop...if there is a faster way then please tell me but this seems to work fine without speed reductions.