Get value from an Arraylist of Objects - processing
问题 I'm making a virtual pet game, and I am now trying to include hunger, however I'm not sure how to make the eat function work. I am trying to make it decrease through the addition of the nutrition value of an item of food. This value is in an object that is stored in an arraylist. Is there a way to reference int nutrition(int eaten) { nutrition = nutrition - eaten; return nutrition; (int eaten will be passed in later) inside ArrayList items; void setup() { items = new ArrayList(); } void draw(