Advertisement
NanoBob

java sample

Feb 18th, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.32 KB | None | 0 0
  1. // this would be the Inventory class
  2.  
  3. void addItem(Item item){
  4.     if (this.items[item]==null){
  5.         this.items[item]=0;
  6.     }
  7.     this.items[item]=this.items[item]+1;
  8.    
  9. }
  10.  
  11.  
  12. // this would be the PlayerInventory class
  13.  
  14. void addItem(Item item){
  15.     super.addItem(item);
  16.     if (item.name=="ak47"){
  17.         this.primaryWeapon=item;
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement