Re: The basics of inventory

hi,
you may do the following:
1. create a class called inv_item containing item name, type and amount (type is not required, but for some types of games it is)
2. create a list in python, an array in bgt, etc which contains different kind of instances from your inv_items class
3. when you want to add an item to inventory, check if it is exist on the list/array, if yes, increase the amount, otherwise add it
4. optionally, sort it alphabeticly (it is not required, but it makes your inventory orgonized)
5. if you want to subtract an item, check if it contains higher amount than 0, if it does, subtract, otherwise remove the item

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Zarvox via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : pauliyobo via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : visualstudio via Audiogames-reflector

Reply via email to