Hey guys, I’ve been posting many, MANY threads on this forum, but I’d like to ask another question:
How do I make an encoder for my game and decoder, or rather, how do I read, write, and encode files?
I want to make this as my key for Twin Days, my personal gaming project to create a text-based adventure written in Java.
As there is a lot of dialogue in an adventure game, is there a way I can store lines and strings inside of a text file, then have my program read it, decode it according to a switch block, then store it inside an array or variable in my program? I don’t want to increase the file size by coding all of the dialogue in Java.
By the way, I also want to create an encoder program that will take text and numbers and create a text file that I can decode into the game.
I thought about doing this through using a counter to count the line number I would need to import next. I would run this method every time I imported a line. After importing the line (which will be a string of encoded characters, of, let’s say, eph, then turn it all back one character, which will make the word “dog”), I would uncode the code and store it as a line in an array list. After using it, I would release it from the array list.
This seems very complicated to me. How do I even write a file, and how do I read it according to line?
How do I create a string-driven switch statement block?