I've been staring at it for some time and I'm getting a mental block
I keep getting a blank map1.txt file and of course a #sprite object not initialized error because there is nothing there.
Does anyone here know what I might be missing?
This is what I have:
Code: Select all
MapSize = 1024
Dim Map1.w(MapSize,MapSize)
;I used this to create an array filled completely with grass tiles only
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; ;Init Map
; For Y = 1 To mapsize
; For X = 1 To mapsize
; Map1(X,Y) = 4
; Next X
; Next Y
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;Load Tile Array
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If ReadFile(1,"map1")
While Eof(1) = 0
For Y = 1 To 1024
For X = 1 To 1024
Map1(X,Y) = ReadWord(1)
Next X
Next Y
Wend
CloseFile(1)
Else
MessageRequester("Information","Couldn't open the file!")
EndIf
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;Save Array when CTRL S is pressed
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If KeyboardPushed(#PB_Key_S)
If KeyboardPushed(#PB_Key_LeftControl) Or KeyboardPushed(#PB_Key_RightControl)
If CreateFile(1,"map1")
If OpenFile(1,"map1")
While Eof(1) = 0
For Y = 1 To 1024
For X = 1 To 1024
WriteWord(1,Map1(X,Y))
Next X
Next Y
Wend
CloseFile(1)
Else
MessageRequester("Information","Couldn't open the file!")
EndIf
Delay(500)
EndIf
EndIf
EndIf
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~