chessmasterhong/WaterEmblem — pull request #15 by DrkSephy (2014-02-27 22:35:08+00:00)
Title: Equipment/Items Menu implemented

Ignore my last pull request, I've figured out a roundabout way of solving some issues presented in the last pull request. **This** pull request features the following changes:

* By pressing [ i ] on the battle mode, the [ITEM] button will appear.
* Left clicking [ITEM] will enumerate the active player's item inventory through buttons.
* By left clicking on an item button, the [EQUIP] button will pop up.
* If the player chooses to equip the first item, it will simply clear the buttons and leave the [ITEM] button there.
In the future, we can spawn an image with text saying " [Active Player Name] equipped [Weapon Name] " for a few seconds before clearing the buttons.
* If the player chooses to equip the second item, a swap function will be called which switches the positions of the items (equipped items are always in index[0] of the items array), then equip it. After this, it will clear all the item buttons and leave the [ITEM] button there. As noted above, we should display the item equipped through a short message.
* In any case, by clicking [ITEM] button again, it will regenerate the items buttons, but in this case it will reflect the new changes of the swapped array.

For the most part, this is working very well. We can extend this in the future to check if the item selected is either an equippable or consumable item, and based on the type, we can spawn either a [EQUIP] or [USE] button. Also, a modified swapItems ( ) method can be written to do trade between two units. That shouldn't be too painful.

One bug/annoying thing: We need a way to clear all the buttons with the name 'btn_items' instead of killing them one by one like I did. I'm currently not sure how to access all entities with the same name, as my results always end up with returning just the last entity with that name, instead of all of them.