I have an "Item" class here that is used to create items.
public class Item {
private String name;
private int id;
private int worth;
//constructor
Item(String _name, int _id, int _worth) {
name = _name;
id = _id;
worth = _worth;
}
public String getName() {
return name;
}
}
This works fine and dandy.. but I don't know how to give them unique ID's, I thought about using
private static Item[] items;
and then when they're created add them to this array, but is that the only way? Also where do I put my code to initialize all the various items in the game? Should it be in the main method, or have a loader of some sort, or have them declared straight away in the Item class using
private static Item apple = new Item("Apple",0,3);
?