That's because you're overwriting objposx1# etc every time in the loop. The only value saved is obviously going to be the last one. Try putting the rest of it inside that loop, like this:
_SaveLevel:
FN$="Exported Levels\Level.lvl"
`this obviously has to be done before the loop so that it doesn't
`get done every time
If File Exist(FN$) Then Delete File FN$
Open To Write 1,FN$
Write String 1,"========================================"
Write String 1,"-This is a level file for Coins Galore -"
Write String 1,"-Do not modify the contents in any way,-"
Write String 1,"-as it could result in a corrupted file-"
Write String 1,"========================================"
Write String 1,""
Write String 1,"========================================"
Write String 1,Str$(ObjsCreated)
`platforms - I don't see why you separated up these bits of
`code in the first place to be honest, but this way the data is
`stored before it's overwritten again, which was your problem
For Obj=10 To 109
If Object Exist(Obj)
`find the information required
ObjPosX1# = Object Position X(Obj)
ObjPosY1# = Object Position Y(Obj)
ObjPosZ1# = Object Position Z(Obj)
`now store that information in the file
Write String 1,"; Object position "+Str$(Obj)
Write String 1,Str$(ObjPosX1#)
Write String 1,Str$(ObjPosY1#)
Write String 1,Str$(ObjPosZ1#)
EndIf
Next Obj
`do the same for coins
Close File 1
Return
EDIT: Added some commenting
EDIT again:
Basically, this was your problem.
For Obj=10 To 109
If Object Exist(Obj)
ObjPosX1# = Object Position X(Obj)
ObjPosY1# = Object Position Y(Obj)
ObjPosZ1# = Object Position Z(Obj)
EndIf
Next Obj
Every time this loop iterates, it overwrites the values with the newest ones. Therefore, no matter what the position of the other objects, only the data of the last one will be stored
Then, when you call this loop
For A=10 To 109
If Object Exist(A)
Write String 1,"; Object position "+Str$(A)
Write String 1,Str$(ObjPosX1#)
Write String 1,Str$(ObjPosY1#)
Write String 1,Str$(ObjPosZ1#)
EndIf
Next A
every single piece of information is being overwritten.
Also for compactness, could you not just do:
_SaveLevel:
FN$="Exported Levels\Level.lvl"
`this obviously has to be done before the loop so that it doesn't
`get done every time
If File Exist(FN$) Then Delete File FN$
Open To Write 1,FN$
Write String 1,"========================================"
Write String 1,"-This is a level file for Coins Galore -"
Write String 1,"-Do not modify the contents in any way,-"
Write String 1,"-as it could result in a corrupted file-"
Write String 1,"========================================"
Write String 1,""
Write String 1,"========================================"
Write String 1,Str$(ObjsCreated)
`every object is now included - I don't see why you would separate
`up the platforms and the coins if they're being treated the same
For Obj=10 To 159
If Object Exist(Obj)
`find and store the information required, all in one fell swoop
ObjPosY1# = Object Position Y(Obj)
ObjPosZ1# = Object Position Z(Obj)
`now store that information in the file
Write String 1,"; Object position "+Str$(Obj)
Write String 1,Str$(Object Position X(Obj))
Write String 1,Str$(Object Position Y(Obj))
Write String 1,Str$(Object Position Z(Obj))
EndIf
Next Obj
Close File 1
Return
