I am using StringTokenizer to read my game map. The problem is that I do not know how to get a entire line of the file. For example, this is my .txt file
block 128 0 523 block 1 9 2 0 SpeedID 200 64 Block 256 Platform 150 70 500 0 Wrong Block 320 0 12 75 Block 384 0
And here I am full line
FileHandle file = Gdx.files.internal ("How to try to print data /" + + Level + "text"); StringTokenizer Token = New String Toner (file.readString ()); While (tokens.hasMoreTokens ()) {string type = token.nxtoken (); Println (type); // With this I only get the first word of the line if (type.equals ("block") {list.add (new brick (integer. PRIINT (token.NXTX), integer PRIINT (token.NXTICAN ()))); }
then here are my results
Block block SpeedID block platform block block
but to print me For example, all the numbers in that row
block 128 0 523 blocks 192 0 SpeedID 200 64 .... ....
< / Div>
Why are you using the string-locator class? Use this legacy class method, this will make the job very simple for you.
No comments:
Post a Comment