import javax.swing.JComboBox;
public class PlayerSkill {
public int damage = 0;
public int manaCost = 0;
public int ID = 0;
public static int skills[]={0,0,0,0};
public static String skillName[]={"skills", "", "", "", ""};
private JComboBox skillList = new JComboBox(skillName);
public PlayerSkill(int damage, int manaCost, int ID){
Gui.f.add(skillList);
skillList.setBounds(100,100,200,200);
this.damage = damage;
this.manaCost = manaCost;
this.ID = ID;
}
public void addNewItem(){
for(int i = 1; i < skills.length; i++){
if(skills[i] == 0 && skillName[i] == ""){
skillList.insertItemAt(skillName(), i);
skills[i] = ID;
return;
}
System.out.println("Test1" + i);
}
}
//Translates item IDs into item names.
public String skillName(){
switch(ID){
case 0: return "epic smile";
case 1: return "rain bow blast";
case 2: return "bro hoof";
case 3: return "gooby pls";
}
return "";
}
}
and here is this code Player.playerRace = "EPIC_FACE"; PlayerSkill epic_smile1 = new PlayerSkill(4,1,1); PlayerSkill epic_smile = new PlayerSkill(4,1,0); epic_smile.addNewItem(); epic_smile1.addNewItem();
It should be printing: skill, epic smile, rain bow blast. But it only prints: skill, and rain bow blast.
Any help would be nice:) Thank you, I really need this done:(

New Topic/Question
Reply



MultiQuote






|