Game Development Reference
In-Depth Information
In this situation we have two possibilities, the non-empty slot may contain an item of the
same type as the one we are dropping. In this case we will increment the item count in that
slot, and remove the item from the source grid and slot. The other case is that the item is
unrelated, in this case, we need to return the item to its source grid, as it is no longer being
dragged.
Dependingonthegamemechanictheremaybeotherpossiblesituations,suchastheability
to stack objects, having limits on the number of items per-slot, etc. There will be many
subtledetailsthatwillultimatelyneedtobedecideduponbasedonthedirectionandfeelof
the game being developed. For example, it's not strictly necessary to drag and drop while
holding down the mouse button, an equally valid approach is to click once on an item and
it becomes selected and will be dropped the next time a click is performed. These details
are fairly straightforward to implement once the support for drag and drop is complete.
Search WWH ::




Custom Search