java - Read by both char and line from text file -
for basic rpg (well, top-down walking around game @ present,) want create method reads "save" file , stores in memory (saving comes later.) i'd save file user-friendly having way create lines of not read method, can set instructions on modifying , such. currently, plan have not read lines % in front, can alter if % causes problem.
the save format i'd have in 1 compressed block - 1 or 2 alphanumeric characters denote contents of single "tile." don't want have 169 lines every screen of area, i'd rather have them in compressed block of 13*13 (again, user-friendly.)
essentially, how can both a) observe if line starts % b) if so, skip next line c) if not, read 2 characters @ time copying string array d) skip blank lines
i understand basic io, haven't been able find way of reading both character , line.
personally, utilize bufferedreader read file line line individual string objects, , inspect contents. can check if line starts comment character using cunningly named string.startswith("%") method, , @ individual characters in line using string.charat(index), or double characters using string.substring(start, start+2).
java file-io
No comments:
Post a Comment