Computer Science Canada File reading difficulties |
Author: | Raknarg [ Mon Jul 18, 2011 6:38 pm ] | ||
Post subject: | File reading difficulties | ||
I'm trying to make a tower defence game. For the map, I've read about using text files, so i'm trying to do that. I read the tutorial, but I don't think I'm getting it. Here's what I have: 1. a text file like this: 00001000000000000000 00001000000000000000 00001000000000000000 00001000000000000000 00001111111111110000 00000000000000010000 00000000000000010000 00000000000000010000 00000000000000010000 00000000000000010000 00000000000000010000 00000000000000010000 00000000000000010000 00000000000000010000 00000000000000010000 00000000000000010000 00001111111111110000 00001000000000000000 00001000000000000000 00001000000000000000 1 = path 0 = building area 2. I have a little bit of code im trying to use:
It tells me later on that variable has no value when I try to use the array, so I know its not assigning any values. I've never done file reading before, so im confused ![]() |
Author: | DemonWasp [ Mon Jul 18, 2011 7:04 pm ] |
Post subject: | RE:File reading difficulties |
Your get line is wrong. Look at it very carefully and try to figure out what's going to be put into your array at (1,1). Once you figure that out, you should know exactly what's happening, and you can look at the Turing help for the get command to learn how to solve it. |
Author: | Raknarg [ Mon Jul 18, 2011 7:20 pm ] |
Post subject: | RE:File reading difficulties |
I'm sorry, I really just don't get it -.-' |
Author: | Tony [ Mon Jul 18, 2011 8:01 pm ] | ||
Post subject: | RE:File reading difficulties | ||
|
Author: | Raknarg [ Tue Jul 19, 2011 7:29 pm ] |
Post subject: | RE:File reading difficulties |
Whoops, found my mistake it was a logic error. |