Item system hhmmm?

Blitz3D Forums/Blitz3D Beginners Area/Item system hhmmm?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hmm, something like this. Putting the check code in a function means you only need to check it when the player picks up an item. MAX_ITEMS can be replaced with a global if you want the maximum number of items to change.

Const MAX_ITEMS = 50
Global Player_Items.Item
Global Player_ItemCount = 0
Dim Player_Items.Item(MAX_ITEMS)

Function AddItem(p_Item.Item)
  If Player_ItemCount <= MAX_ITEMS then
    ;Not carrying too much, add the item
    Player_ItemCount = Player_ItemCount + 1
    Player_Items(Player_ItemCount) = p_Item
  Else
    Print "You're carrying too much"
  EndIf
End Function


Hope that helps!