RPG-Inventory - Drag and Drop

Index

Stats

4,722 visits, 12,944 views

Translations

This tutorial hasn't been translated.

Tools

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

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