Well. I was looking at one of the codes in the codebase, and was just modifying it a bit. First, let me show you the code I've got.
LevelObject=2
for y=12 to 1 step -1
for x=1 to 12
read TestLevel1Data
if TestLevel1Data=1
make object box LevelObject,50,50,50
position object LevelObject,x*50,y*50,0
make object collision box LevelObject,-25,-25,-25,25,25,25,0
inc LevelObject
endif
if TestLevel1Data=2
position object 1,x*50,y*50,0
xx#=x*50
yy#=y*50
zz#=0
if TestLevel1Data=3
make object box LevelObject,50,50,50
position object LevelObject,x*50,y*50,0
make object collision box LevelObject,-25,-25,-25,25,25,25,0
color object LevelObject,RGB(255,0,0)
inc LevelObject
endif
endif
next x
next y
And TestLevel1Data is:
TestLevel1Data:
data 1,1,1,1,1,1,1,1,1,1,1,1
data 1,0,0,0,0,0,0,0,0,0,3,1
data 1,0,0,0,0,0,0,0,0,0,0,1
data 1,0,0,0,0,1,0,0,3,0,0,1
data 1,0,0,0,0,0,0,0,0,0,0,1
data 1,0,0,0,0,0,3,0,0,0,0,1
data 1,0,0,0,0,0,0,0,0,0,0,1
data 1,0,0,0,3,0,0,0,0,0,0,1
data 1,0,0,0,0,0,0,0,0,0,0,1
data 1,0,3,0,0,0,0,0,0,0,0,1
data 1,2,3,0,0,0,0,0,0,0,0,1
data 1,1,1,1,1,1,1,1,1,1,1,1
To sum it up quickly, it creates a "level" of blocks where the numbers are. So #1 represents a plain block, #2 is the spawn point for the camera, and #3 is a colored block. But, whenever I do it, it doesn't seem to work in the way I want.
For instance, as the code is right now, only blocks with 1's will spawn. 3's will not spawn. But, if I change the code quickly:
LevelObject=2
for y=12 to 1 step -1
for x=1 to 12
read TestLevel1Data
[b]if TestLevel1Data=3[/b]
make object box LevelObject,50,50,50
position object LevelObject,x*50,y*50,0
make object collision box LevelObject,-25,-25,-25,25,25,25,0
inc LevelObject
endif
if TestLevel1Data=2
position object 1,x*50,y*50,0
xx#=x*50
yy#=y*50
zz#=0
[b]if TestLevel1Data=1[/b]
make object box LevelObject,50,50,50
position object LevelObject,x*50,y*50,0
make object collision box LevelObject,-25,-25,-25,25,25,25,0
color object LevelObject,RGB(255,0,0)
inc LevelObject
endif
endif
next x
next y
(Basically, I've swapped what block spawns what: "1" now spawns "3", and vice versa.) So, under that quick change, What used to work now no longer works, and vice versa.
I'm wondering how I can fix this. I'm taking a guess that when it's doing the math, it recognizes #3 as the x, and does 3 x 50, rather then 1 x 50. But if that were true, I would still see the object being spawned, but higher in the air, which I don't. So what's wrong with the code, that makes 3 not work, and 1 will work?