Android game rpg inventory system

前端 未结 5 918
不知归路
不知归路 2021-01-12 04:37

I am using an ArrayList as my \"inventory\". I am having trouble figuring out a way to add multiples of the same item without taking up a spot in the \"inventory\". For exam

5条回答
  •  天命终不由人
    2021-01-12 05:23

    How about the following

    
    public class Item{
        int count;
        String name;
    }
    
    

    Then have a list representing the inventory

    
    public class Player {
        List inventory =  new ArrayLis();
    
    }
    
    

提交回复
热议问题