0

I'm attempting to create a simple roguelike, and I would like to read my monster information in from a data file, but I'm running into a problem with reading in the symbol of the monster because the game is in ascii. The entire project is on github at https://github.com/Knickkennedy/roguelike-alpha

An example line would be as followed:

Mob Name        :   Symbol  :       Color           :   HP  :   Base Attack :   Base Armor
goblin          :   'g'     :   0 : 255 : 0 :       :   10  :   10          :   5

and I'm attempting to create a new "Mob" class with it, like Mob newMob = new Mob(etc etc) but I don't know how to read a character for symbol, or to parse for a color as well, hence why color is split up into the hex ints. Any help would be very appreciated. Thanks!

K. Kennedy
  • 21
  • 6
  • Use Color.parseColor(myPassedColor) to get it as an Integer – Fady Saad May 05 '17 at 03:58
  • What have you tried so far yourself? – QBrute May 05 '17 at 04:00
  • @QBrute I've tried reading it as a string, then using getcharat(0), I've tried using an if statement, which was ugly and convoluted, I've tried getbyte, but I believe a char is 2 bytes and that's why that won't work. Besides that I'm a little lost. Tried splitting it into a string array, reading by token – K. Kennedy May 05 '17 at 04:04
  • Maybe try with different file format like `csv` (there are libraries for reading those already) instead of creating Your own format ? – Michal Przybylowicz Oct 11 '17 at 12:43

0 Answers0