I am making a texted based game and I have problem creating objects inside a loop
here is my code
int i = 1;
Skill[] Skill_List = null;
String[] Skill_Info;
File directory = new File("D:\Program Files\Game_dev2\src\Database\Skills");
int FileCount = directory.list().length;
while (i < FileCount - 1) {
Scanner Skill_Info_Data = new Scanner(
new File("D:\Program Files\Game_dev2\src\Database\Skills\Skill" + (i) + ".csv"));
int j = 0;
while (Skill_Info_Data.hasNext()) {
Skill_Info = Skill_Info_Data.nextLine().split(",");
String Name = Skill_Info[0];
String Type = Skill_Info[1];
String Desc = Skill_Info[2];
int Skill_Level = Integer.parseInt(Skill_Info[3]);
int Effect = Integer.parseInt(Skill_Info[4]);
int Effect2 = Integer.parseInt(Skill_Info[5]);
int Manacost = Integer.parseInt(Skill_Info[6]);
int Cooldown = Integer.parseInt(Skill_Info[7]);
String Skill_From = Skill_Info[8];
int Power_Gain = Integer.parseInt(Skill_Info[9]);
Skill_List = new Skill[] { new Skill(Name, Type, Desc, Skill_Level, Effect, Effect2, Manacost, Cooldown,
Skill_From, Power_Gain) };
j++;
}
i++;
}
The problem is that the there is only 1 skilled stored in the array and I am running out of idea on how to fix this.