Dragging items

I mentioned before that I’ve now converted almost all buttons into “items”, and that this is moving toward supporting an inventory for the player and for in-game characters.

I now have the second step in place;  successfully dragging buttons around from one “item slot” to another.  Item slots may be of different sizes (if desired);  items scale as required to fill the slot that they’re placed into.

There are a few awkward bits that I still need to solve;  I haven’t yet worked out exactly which object is responsible for destroying these items, which means that clean-up during game shutdown is pretty messy, and also leads to some non-ideal update logic.  I need to fix that tomorrow.  But ignoring those sorts of issues, the buttons can now be dragged between slots, activated in each, etc.  Right now, it’s even possible to drag buttons out of the action bar and leave them in a random spot on the screen, swap to a different action bar, and then place the button into that other action bar.

In the screenshot, I’ve dragged the “edit colors” button from the third slot of the action bar to the seventh, and am showing that the tooltip still works, even in the new position.

In practice, I don’t actually want these buttons to be draggable.  But I’m going to need this functionality for perishable items, and so it’s easiest to test with these ones, since the player starts with access to them.

Anyhow, next steps (after the general cleanup I mentioned above) are going to be:

  1. Make placeholder sprite images for the basic editing tools.
  2. Add numbers to the corners of these item slots (hovering over button images), and hook these up as hotkeys, so people can use number keys to activate abilities.
  3. Start thinking about procedural generation of simple icons for class combat abilities.