Hi all,
I am attempting to make a wireframe maze game - you know the type, the really early days of games early Ultima and Wizardry type... I (think I) have set everything up (its still in its very early days!) but when I test the maze data, all I seem to return are Zeros. So it doesnt appear to be reading the maze data correctly. This is my 1st crack at getting into data statements, so I still dont fully understand how they work, but with Krylars book and a bit of blood sweat and tears, I'm hoping to crack the nut in the next couple of days. Have a look at the code and see if you can see the (probably really simple) error I have made...
I am attempting to make a wireframe maze game - you know the type, the really early days of games early Ultima and Wizardry type... I (think I) have set everything up (its still in its very early days!) but when I test the maze data, all I seem to return are Zeros. So it doesnt appear to be reading the maze data correctly. This is my 1st crack at getting into data statements, so I still dont fully understand how they work, but with Krylars book and a bit of blood sweat and tears, I'm hoping to crack the nut in the next couple of days. Have a look at the code and see if you can see the (probably really simple) error I have made...
; Wireframe maze drawing program Graphics 640,480 SetBuffer BackBuffer() ; declare the map variable Map_Length=16 Map_Height=16 Dim maze(Map_Length,Map_Height) While Not KeyHit(1) ; clear the screen Cls DrawBox ReadMaze For i=0 To map_Length For j=0 To map_height Print maze(i,j) Next Next Flip Wend End ;****************************** ;* Draws a box-like border * ;* around the main maze * ;* Player area * ;****************************** Function DrawBox() Line 82,19,294,19 Line 294,19,294,119 Line 294,119,82,119 Line 82,119,82,19 End Function ;****************************** ;* Reads the data statements * ;* to load the maze data * ;* into the maze()() variable * ;****************************** Function ReadMaze() ; Read (load) in the maze data into a variable Restore MazeData For y = 0 To Map_Height-1 For x = 0 To Map_Length-1 Read a ; get the map data and store into value maze(x,y) = a Next ; x Next ; y End Function .MazeData Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,1,0,1,1,1,0,1,0,1,0,1,1,0,1 Data 1,0,1,0,1,0,0,0,1,1,1,0,1,1,0,1 Data 1,0,1,0,0,0,1,0,0,0,1,0,0,1,0,1 Data 1,0,1,1,1,0,1,0,1,0,1,1,1,1,0,1 Data 1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1 Data 1,0,1,1,1,0,1,0,1,1,1,0,1,1,0,1 Data 1,0,1,0,0,0,1,1,0,0,1,0,1,1,0,1 Data 1,0,1,0,1,0,1,1,1,1,1,0,1,1,0,1 Data 1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,1,1,1,0,1,0,1,0,1,1,1,1,0,1 Data 1,0,0,0,1,0,1,0,1,0,0,0,0,1,0,1 Data 1,0,1,1,1,0,1,1,1,1,1,1,1,1,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1