I'm making a game where I want to read from a .txt the attributes of the monsters. When I read the file and put the values into variables, those variables get garbage data instead of the .txt data. It's weird because it's only happening in my main project. I created a test project with the same class and literally copypasted the code, and there it works perfectly.
Here is my file reading method:
void Game::readMonsters() {
string monsterName, monsterFile = "";
int life, def, id = NULL;
ifstream monsters("assets/monsters.txt");
if (monsters) {
    monsters >> nMonsterTypes; // this variable exists in Game.h
    type = new MonsterType[nMonsterTypes](); // this object exists in Game.h
    for (int i = 0; i < nMonsterTypes; i++) {
        // all those variables are being set as memory garbage:
        monsters >> id;
        type[i].setID(id);
        monsters >> life;
        type[i].setHP(life);
        monsters >> def;
        type[i].setDefense(def);
        monsters >> monsterFile;
        type[i].setFile(monsterFile);
        monsters >> monsterName;
        type[i].setName(monsterName);
    }
}
monsters.close();
}
I appreciate any help!
