RPG-Inventory - Drag and Drop

1

Index

Stats

11,168 visits, 25,445 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 6 Jan, 2012. Last updated 19 Feb, 2019

Drop the item

We now know, if we can drop the item or not. We use this information for the following:

The only line that could be unclear is the one with the ItemUID. We store this one in the corresponding slot, so we are able to recall which item is stored for the "owner" of the slot. (When you place the slot sprite on your layout, make sure you set the instance variable Owner to the appropriate value!)

If the item is marked as destroy the instance of the inventoryItem actually gets destroyed after the drop. This happens if its dropped to the trash can.

Control slots - filled or empty

By now, you should be able to understand what is going on:

To mark the slot itemUID as cleared, we set it to -1

Supporting the tutorial

Before we look at, on how we get a readable list of item, our avatar holds, lets look at the supporting functions for this tutorial:

This event just fills the "country side" slot with randomly generated items, so you can play around with the tutorial.

The last event, changes to the layout, that lists the items of the avatar.

  • 0 Comments

Want to leave a comment? Login or Register an account!