{"id":2545,"date":"2012-05-23T22:17:26","date_gmt":"2012-05-23T12:17:26","guid":{"rendered":"http:\/\/www.vectorstorm.org\/?p=2545"},"modified":"2012-05-23T22:17:26","modified_gmt":"2012-05-23T12:17:26","slug":"dragging-items","status":"publish","type":"post","link":"https:\/\/www.vectorstorm.com.au\/2012\/05\/23\/dragging-items\/","title":{"rendered":"Dragging items"},"content":{"rendered":"

\"\"<\/a>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.<\/p>\n

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

There are a few awkward bits that I still need to solve;\u00a0 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.\u00a0 I need to fix that tomorrow.\u00a0 But ignoring those sorts of issues, the buttons can now be dragged between slots, activated in each, etc.\u00a0 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.<\/p>\n

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.<\/p>\n

In practice, I don’t actually want these buttons to be draggable.\u00a0 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.<\/p>\n

Anyhow, next steps (after the general cleanup I mentioned above) are going to be:<\/p>\n

    \n
  1. Make placeholder sprite images for the basic editing tools.<\/li>\n
  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.<\/li>\n
  3. Start thinking about procedural generation of simple icons for class combat abilities.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"

    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;\u00a0 successfully dragging buttons around from one “item slot” to another.\u00a0 Item slots may be of different sizes (if desired);\u00a0…<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[24,25],"tags":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/po9WK-F3","_links":{"self":[{"href":"https:\/\/www.vectorstorm.com.au\/wp-json\/wp\/v2\/posts\/2545"}],"collection":[{"href":"https:\/\/www.vectorstorm.com.au\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vectorstorm.com.au\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vectorstorm.com.au\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vectorstorm.com.au\/wp-json\/wp\/v2\/comments?post=2545"}],"version-history":[{"count":0,"href":"https:\/\/www.vectorstorm.com.au\/wp-json\/wp\/v2\/posts\/2545\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.vectorstorm.com.au\/wp-json\/wp\/v2\/media?parent=2545"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vectorstorm.com.au\/wp-json\/wp\/v2\/categories?post=2545"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vectorstorm.com.au\/wp-json\/wp\/v2\/tags?post=2545"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}